diff --git a/.travis.yml b/.travis.yml index e59e6d42..68e6b203 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ script: branches: only: - master - - model_adequacy + - REL-names notifications: email: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b5145835..60046292 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,10 @@ Changelog =========== + +2.4.0 +------ +* Added REL method for detecting sites of positive selection. + 2.3.8 ------ * Fixed bug in `phydms_prepalignment` due to `mafft` shortening sequence names. diff --git a/docs/ExpCM.rst b/docs/ExpCM.rst index 433ac394..c407093f 100644 --- a/docs/ExpCM.rst +++ b/docs/ExpCM.rst @@ -5,7 +5,7 @@ ======================================================= .. contents:: - :depth: 2 + :depth: 3 Overview ------------- @@ -143,9 +143,12 @@ In this case, :math:`\beta` is drawn from ``--ncats`` categories placed at the m Note that the mean :math:`\beta` value is then :math:`\alpha_{\beta} / \beta_{\beta}`. Identifying diversifying selection via site-specific :math:`\omega_r` values ------------------------------------------------------------------------------- +----------------------------------------------------------------------------------- One type of interesting selection is *diversifying selection*, where there is continual pressure for amino-acid change. Such selection might be expected to occur at sites that are targeted by adaptive immunity or subjected to some other form of selection which constantly favors changes in the protein sequence. At such sites, we expect that the relative rate of nonsynonymous substitutions will be higher than suggested by the site-specific preferences :math:`\pi_{r,a}` due to this diversifying selection. +FEL-like approach +++++++++++++++++++ + To detect diversifying selection at specific sites within the framework of the *ExpCM* implemented in ``phydms``, we use an approach that is highly analogous the *FEL* (**f**\ixed **e**\ffects **l**\ikelihood) method described by `Kosakovsky Pond and Frost, Mol Biol Evol, 22:1208-1222`_. Essentially, the tree topology, branch lengths, and all shared model parameters are fixed to their maximum-likelihood values optimized over the entire gene sequence. Then for each site :math:`r`, we fit a site-specific ratio of the rate of synonymous versus nonsynonymous substitutions while holding all holding all the other tree and model parameters constant. Effectively, this is fitting a different :math:`\omega_r` for each site, and so this analysis is indicated as ``--omegabysite`` in the ``phydms`` options. Specifically, after fixing all of the other parameters as described above, for each site :math:`r` we re-define Equation :eq:`Frxy_ExpCM` as @@ -166,6 +169,44 @@ The null hypothesis is that :math:`\omega_r = 1`. We compute a P-value for rejec Significant support for a value of :math:`\omega_r > 1` can be taken as evidence for diversifying selection beyond that expected given the constraints encapsulated in the site-specific amino-acid preferences. Significant support for a value of :math:`\omega_r < 1` can be taken as evidence for selection against amino-acid change beyond that expected given the constraints encapsulated in the site-specific amino-acid preferences. Note, however, that if the site-specific preferences don't accurately describe the real constraints, you might get :math:`\omega_r \ne 1` simply because of this fact -- so you will want to examine if sites might be subject to selection that is better described by modulating the stringency parameter :math:`\beta` or by invoking differential preferences, as described below. +REL-like approach ++++++++++++++++++++ + +In addition to the site-specific FEL-based approach discussed above, we have also implemented an approach that is highly analogous to the REL (**r**\andom **e**\ffects **l**\ikelihood) method described by `Nielsen and Yang, Genetics, 148; 929-936`_. +Rather than fitting the ratio of the rate of synonymous versus nonsynonymous substitutions for *each* site, the REL approach involves fitting a discretized gamma distribution of omega values across *all* sites. +When fitting this gamma distribution of :math:`\omega`, we let :math:`\omega` values be drawn from *K* discrete categories, with each category given equal proportion. +This gamma distribution is described by a shape parameter, :math:`\alpha_{\omega}` and an inverse scale parameter, :math:`{\beta_\omega}`, which are fit simultaneously with the tree topology, branch lengths, and other shared model parameters using maximum likelihood estimation. +We then infer selection at individual sites using an empirical Bayesian approach. + +In the empirical Bayesian approach, we integrate the gamma distribution of omega values by approximating the distribution with *J* discrete categories, with each category having equal proportion. +Integrating the distribution is much faster than fitting the distribution, so typically *J* is set to be greater than *K* to save time. +Then, for each discrete category, *j*, we assign the mean value of its subdistribution, denoted as :math:`\omega_j`, to that category. +This analysis is indicated as ``--omega_random_effects_likelihood`` in the ``phydms`` options. +Given an integer greater than one, the ``--empirical_bayes`` option specifies the number of discrete categories used to approximate the gamma distribution for integration, denoted as *J*. + +We do not know *a priori* which discrete category a site belongs to, so the likelihood function for observing a site's sequence data, :math:`\mathcal{S}_r`, is given by the average over all possibilities, i.e., + +.. math:: + :label: rel_likelihood_function + + \mathcal{L}(\mathcal{S}_r) = \frac{1}{J}\sum_{j = 0}^{J - 1} \mathcal{L}(\mathcal{S}_r | \omega_j) + +where :math:`\mathcal{L}(\mathcal{S}_r | \omega_j)` is the likelihood function for observing sequence data :math:`\mathcal{S}_r` given that site *r* is in category *j*. + +Then, the posterior probability that a site, *r*, with sequence data, :math:`\mathcal{S}_r`, belongs to category, *j*, is given by + +.. math:: + :label: rel_posterior_probability + + \text{Pr}(\omega_j | \mathcal{S}r) = \frac{\frac{1}{J}\mathcal{L}(\mathcal{S}_r | \omega_j)}{\mathcal{L}(\mathcal{S}_r)} = \frac{\mathcal{L}(\mathcal{S}_r | \omega_j)}{\sum_{i=0}^{J - 1}\mathcal{L}(\mathcal{S}_r | \omega_i)}. + +The category *j* which maximizes the posterior probability of observing :math:`\omega_j` given sequence data, :math:`\mathcal{S}_r`, is the most likely category for site, *r*. We calculate the posterior probability of diversifying selection at individual sites by summing the posterior probabilities over which that site belongs to any category, *j*, where :math:`\omega_j > 1`, i.e., + +.. math:: + :label: rel_diversifying_selection + + \text{Pr}(\omega_r > 1) = \sum_{j: \omega_j > 1}\text{Pr}(\omega_j | \mathcal{S}_r) + Identifying differentially selected amino acids by fitting preferences for each site --------------------------------------------------------------------------------------- A more complete approach is to examine each site to see the extent to which the preferences for each amino acid in nature differ from those encapsulated in the :math:`\pi_{r,a}` values. The advantage of this approach is that it can identify any form of differential selection (the approach in the previous section works best when the selection in nature is more uniform across amino acids than the :math:`\pi_{r,a}` values), and also that it can pinpoint specific amino acids that are favored or disfavored in natural evolution by an unexpected amount. The disadvantage is that ``phydms`` does not currently implement a good way to statistically test the significance of this type of differential selection, so although you can visualize and assess the selection it's hard to say that any given differential selection is significant at some specific P-value threshold. diff --git a/docs/implementation.rst b/docs/implementation.rst index f66ff23d..d99342c5 100644 --- a/docs/implementation.rst +++ b/docs/implementation.rst @@ -928,7 +928,7 @@ The models described above fit a single value to each model parameter. We can also fit a distribution of values across sites for one model parameter :math:`\lambda`. For instance, when :math:`\lambda` is the :math:`\omega` of the *YNGKP* models, we get the *YNGKP_M5* model described in `Yang, Nielsen, Goldman, and Krabbe Pederson, Genetics, 155:431-449`_. -Specifically, let the :math:`\lambda` values be drawn from :math:`K` discrete categories with lambda values :math:`\lambda_0, \lambda_2, \ldots, \lambda_{K-1}`, and give equal weight to each category. Then the overall likelihood at site :math:`r` is +Specifically, let the :math:`\lambda` values be drawn from :math:`K` discrete categories with lambda values :math:`\lambda_0, \lambda_1, \ldots, \lambda_{K-1}`, and give equal weight to each category. Then the overall likelihood at site :math:`r` is .. math:: diff --git a/docs/installation.rst b/docs/installation.rst index 1aac7bbe..378fe595 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -8,7 +8,7 @@ Installation Minimal requirements ---------------------- -`phydms`_ is written in `Python`_. It requires Python 3.5 or higher. +`phydms`_ is written in `Python`_. It requires Python 3.6 or higher. Straightforward installation requires the `Python`_ package management system `pip`_ and a ``C`` compiler such a ``gcc`` (there are some ``cython`` extensions). diff --git a/docs/phydms_prog.rst b/docs/phydms_prog.rst index 2b4fcc2e..1ac398b0 100644 --- a/docs/phydms_prog.rst +++ b/docs/phydms_prog.rst @@ -79,10 +79,11 @@ Command-line usage This option is not typically recommended. It will typically lead to only very slight improvements in log likelihood at substantial computational cost. \-\-omegabysite - If using a YNGKP model, then the :math:`\omega_r` value is nearly analogous that obtained using the *FEL* model described by `Kosakovsky Pond and Frost, Mol Biol Evol, 22:1208-1222`_. If using and *ExpCM*, then :math:`\omega_r` has the meaning described in :ref:`ExpCM`. Essentially, we fix all other model / tree parameters and then compare a model that fits a synonymous and nonsynonymous rate to each site to a null model that only fits a synonymous rate; there is evidence for :math:`\omega_r \ne 1` if fitting both nonsynonymous and synonymous rate gives sufficiently better likelihood than fitting synonymous rate alone. See also the ``--omegabysite_fixsyn`` option. + If using a YNGKP model, then the :math:`\omega_r` value is nearly analogous that obtained using the *FEL* model described by `Kosakovsky Pond and Frost, Mol Biol Evol, 22:1208-1222`_. If using an *ExpCM*, then :math:`\omega_r` has the meaning described in :ref:`ExpCM`. Essentially, we fix all other model / tree parameters and then compare a model that fits a synonymous and nonsynonymous rate to each site to a null model that only fits a synonymous rate; there is evidence for :math:`\omega_r \ne 1` if fitting both nonsynonymous and synonymous rate gives sufficiently better likelihood than fitting synonymous rate alone. See also the ``--omegabysite_fixsyn`` option. + For an alternative method to determine site-specific :math:`\omega_r`, please see the ``--omega_random_effects_likelihood`` option. \-\-omegabysite_fixsyn - This option is meaningful only if you are using ``--omegabysite``. If you use this option, then we compare a model in which we fit a nonsynonymous rate to each site to a model in which we fit nothing. The synonymous rate is not fit, and so is assumed to be equal to the overall value fit for the tree. According to `Kosakovsky Pond and Frost, Mol Biol Evol, 22:1208-1222`_, in some cases this can yield greater power if there is relatively limited data. However, it comes with the risk of giving spurious results if there is substantial variation in the synonymous substitution rate among sites. + This option is meaningful only if you are using ``--omegabysite``. If you use this option, then we compare a model in which we fit a nonsynonymous rate to each site to a model in which we fit nothing. The synonymous rate is not fit, and so is assumed to be equal to the overall value fit for the tree. According to `Kosakovsky Pond and Frost, Mol Biol Evol, 22:1208-1222`_, in some cases this can yield greater power if there is relatively limited data. However, it comes with the risk of giving spurious results if there is substantial variation in the synonymous substitution rate among sites. This distribution is then partitioned into several discrete categories \-\-diffprefsbysite This option can only be used with *ExpCM* models, **not** with *YNGKP* models. @@ -114,6 +115,25 @@ Command-line usage This option computes an average of each preference across sites (:math:`\pi_a = \frac{1}{L} \sum_r \pi_{r,a}` where :math:`r = 1, \ldots, L`), and then uses these average preferences for all sites. This can be used as a control, as it merges all the information in the preferences into a non-site-specific model. + \-\-omega_random_effects_likelihood + If using a YNGKP model, then the :math:`\omega_r` value is nearly analogous that obtained using the *REL* model described by `Kosakovsky Pond and Frost, Mol Biol Evol, 22:1208-1222`_. + If using an *ExpCM*, then :math:`\omega_r` has the meaning described in :ref:`ExpCM`. + We compute the posterior probability that :math:`\omega_r \ne 1`, e.g., :math:`\omega_r > 1` or :math:`\omega_r < 1` given a distribution of :math:`\omega` across the gene. + For an alternative method to determine site-specific :math:`\omega_r`, please see the ``--omegabysite`` option. + + This option requires a gamma-distributed :math:`\omega`. + For *ExpCM*, use the ``--gammaomega`` option. + For *YNGKP* models, use the *YNGKP_M5* model. + To control the number of categories used to compute the posterior probability, see the ``--REL_ncats`` option. + + \-\-REL_ncats + More categories leads to slightly longer run-time, values of 50-100 are usually adequate. + + Note that while the ``--ncats`` and ``--REL_ncats`` have a similar definition, the number of categories used to discretize a distribution, they are slightly different in practice. + ``--ncats`` controls the discretization while the distribution is being fit. + ``--REL_ncats`` controls the discretization of the fit distribution while calculating the posterior. + The calculation of the posterior is much more computationally efficient, so we recommend that ``--ncats`` :math:`<<` ``--REL_ncats``. + \-\-minbrlen All branches with lengths less than this value will be set to this value in the initial starting tree. Branches can still end up with lengths less than this after subsequent optimization of this starting tree. @@ -240,9 +260,42 @@ Here is an example of the first few lines of a file. The entries are tab separat 127 -0.0088 -0.0006 -0.0010 0.1423 -0.0021 -0.0179 -0.0059 -0.0096 -0.0208 -0.0100 -0.0021 -0.0095 -0.0007 -0.0066 -0.0073 -0.0114 -0.0146 -0.0075 -0.0010 -0.0049 0.1423 289 -0.0079 -0.0127 -0.0005 -0.0002 -0.0228 -0.0005 -0.0154 -0.0156 -0.0033 -0.0167 -0.0113 -0.0034 -0.0004 -0.0004 -0.0094 -0.0020 -0.0028 -0.0133 -0.0006 0.1391 0.1391 -The first column gives the site numbers, subsequent columns give the differential preference (:math:`\Delta\pi_{r,a}`) for each amino acid. +The first column gives the site number, subsequent columns give the differential preference (:math:`\Delta\pi_{r,a}`) for each amino acid. The last column gives the half absolute sum of the differential preferences, :math:`\sum_a |\Delta\pi_{r,a}|`, at each site. This quantity can range from zero to one. The sites are sorted with the highest half absolute sum differential preference first. +Gamma-distributed discrete category file ++++++++++++++++++++++++++++++++++++++++++++ +This file has the suffix ``_omegabycategory.csv``, and is created only if using the ``--omega_random_effects_likelihood`` option. +This file gives the posterior probability of each site falling into each category, as well as the mean :math:`omega` value of each discretized category. +These posterior probabilities are computed nearly identically to those obtained using the *REL* model as described in `Kosakovsky Pond and Frost, Mol Biol Evol, 22:1208-1222`_. + +Here is an example of the first few lines of a file. The entries are comma separated:: + + site,post_probability,omega + 1,0.2503826180447997,0.0695219697627359 + 2,0.24755166505269052,0.0695219697627359 + 3,0.2526024760622074,0.0695219697627359 + 4,0.2530711698554593,0.0695219697627359 + 5,0.24843828974534077,0.0695219697627359 + +The ``post_probability`` column gives the posterior probability of that site falling into a given category. +The sites and omega values are sorted in ascending numerical order. + +Site-specific posterior probability file ++++++++++++++++++++++++++++++++++++++++++++ +This file has the suffix ``_posteriorprobabilities.csv``, and is created only if using the ``--omega_random_effects_likelihood`` option. +This file gives the sum total probability of each site having an :math:`\omega_r > 1`. +These posterior probabilities are computed nearly identically to those obtained using the *REL* model as described in `Kosakovsky Pond and Frost, Mol Biol Evol, 22:1208-1222`_. + +Here is an example of the first few lines of a file. The entries are comma separate:: + + site,pr(omega > 1) + 8,0.2541928826887663 + 2,0.2533289672072823 + 6,0.252851860574337 + 9,0.25243889606707554 + +The pr(omega > 1) gives the sum total posterior probability of the given site being under diversifying selection. .. include:: weblinks.txt diff --git a/docs/weblinks.txt b/docs/weblinks.txt index 755a3e62..8926acaa 100644 --- a/docs/weblinks.txt +++ b/docs/weblinks.txt @@ -41,6 +41,7 @@ .. _`McCandlish and Stoltzfus, Quarterly Review of Biology, 89:225-252`: http://www.ncbi.nlm.nih.gov/pubmed/25195318 .. _`HKY85`: https://dx.doi.org/10.1007%2FBF02101694 .. _`Kosakovsky Pond and Frost, Mol Biol Evol, 22:1208-1222`: http://mbe.oxfordjournals.org/content/22/5/1208.full +.. _`Nielsen and Yang, Genetics, 148; 929-936`: https://www.genetics.org/content/148/3/929 .. _`AIC`: https://en.wikipedia.org/wiki/Akaike_information_criterion .. _`reStructuredText`: http://docutils.sourceforge.net/rst.html .. _`Julien Dutheil`: http://kimura.univ-montp2.fr/jdutheil/CMS/index.php/ diff --git a/phydmslib/_metadata.py b/phydmslib/_metadata.py index 2fb9e198..0d88207d 100644 --- a/phydmslib/_metadata.py +++ b/phydmslib/_metadata.py @@ -1,4 +1,4 @@ -__version__ = '2.3.8' +__version__ = '2.4.0' __author__ = 'the Bloom lab (see https://github.com/jbloomlab/phydms/contributors)' __url__ = 'http://jbloomlab.github.io/phydms' __author_email__ = 'jbloom@fredhutch.org' diff --git a/phydmslib/constants.py b/phydmslib/constants.py index a96c2fe4..a177b5e3 100644 --- a/phydmslib/constants.py +++ b/phydmslib/constants.py @@ -45,6 +45,8 @@ `CODON_NT_COUNT` (`numpy.ndarray` of int, shape `(N_NT, N_CODON)`) Element `[w][x]` gives the number of occurrences of nucleotide `w` in codon `x`. + `CODONSTR_TO_AASTR` (dict): + mapping of codons to amino acids. `STOP_CODON_TO_NT_INDICES` (`numpy.ndarray` of float, shape `(N_STOP, 3, N_NT)`) Element `[x][p][w]` is 1.0 if codon position `p` is nucleotide `w` in stop codon `x` and 0.0 otherwise. @@ -77,6 +79,7 @@ STOP_POSITIONS = numpy.ones((3, N_NT), dtype = 'float') CODON_TO_INDEX = {} INDEX_TO_CODON = {} +CODONSTR_TO_AASTR = {} CODON_TO_AA = [] i = 0 for nt1 in sorted(NT_TO_INDEX.keys()): @@ -84,13 +87,14 @@ for nt3 in sorted(NT_TO_INDEX.keys()): codon = nt1 + nt2 + nt3 aa = str(Bio.Seq.Seq(codon).translate()) + CODONSTR_TO_AASTR[codon] = aa if aa != '*': CODON_TO_INDEX[codon] = i INDEX_TO_CODON[i] = codon CODON_TO_AA.append(AA_TO_INDEX[aa]) i += 1 else: - STOP_CODON_TO_NT_INDICES.append(numpy.zeros((3, N_NT), + STOP_CODON_TO_NT_INDICES.append(scipy.zeros((3, N_NT), dtype='float')) STOP_CODON_TO_NT_INDICES[-1][0][NT_TO_INDEX[nt1]] = 1.0 STOP_CODON_TO_NT_INDICES[-1][1][NT_TO_INDEX[nt2]] = 1.0 diff --git a/phydmslib/file_io.py b/phydmslib/file_io.py index d3318e91..136855fa 100644 --- a/phydmslib/file_io.py +++ b/phydmslib/file_io.py @@ -391,6 +391,37 @@ def readDivPressure(fileName): divPressure[r] = df[df['site'] == r]["divPressureValue"].tolist()[0] return divPressure +def outputAlignment(alignment, fname): + """Output a `fasta` alignment. + + Within `phydms`, alignments are stored as a list of tuples + ([(seq_id), seq]). This function takes such a list and outputs the + alignment in the `fasta` format. + + Args: + `alignment` (lit of tuples) + Each element in the list is one sequence stored as a + tuple (seq_id, seq). All sequnces in the alignment should + be codon sequences (divisible by 3) and the same length. + Sequence names should be unique. + `fname` (`str`) + Name of the created `fasta` file. + + """ + # check the aligment + seq_ids = [seq[0] for seq in alignment] + seq_lengths = [len(seq[1]) for seq in alignment] + assert len(seq_ids) == len(set(seq_ids)), "Sequence names should be unique." + assert len(set(seq_lengths)) == 1, "Sequences should be the same length." + assert seq_lengths[0] % 3 == 0, "Sequences should be divisible by 3." + + with open(fname, "w") as f: + for i, seq in enumerate(alignment): + if i == 0: + f.write(">{0}\n{1}".format(seq[0], seq[1])) # no leading \n + else: + f.write("\n>{0}\n{1}".format(seq[0], seq[1])) + if __name__ == '__main__': import doctest diff --git a/phydmslib/parsearguments.py b/phydmslib/parsearguments.py index ebafc9ad..f0542fa2 100644 --- a/phydmslib/parsearguments.py +++ b/phydmslib/parsearguments.py @@ -320,12 +320,26 @@ def PhyDMSComprehensiveParser(): parser.add_argument('--gammabeta', dest='gammabeta', action=\ 'store_true', help="Fit ExpCM with gamma distributed beta.") parser.set_defaults(noavgprefs=False) + parser.add_argument('--ncats', default=4, type=IntGreaterThanOne, + help='Number of categories for gamma-distribution.') + parser.add_argument('--minbrlen', type=FloatGreaterThanZero, + default=phydmslib.constants.ALMOST_ZERO, + help="Adjust all branch lengths in starting 'tree' to >= this.") parser.add_argument('--no-avgprefs', dest='noavgprefs', action='store_true', help="No fitting of models with preferences averaged across sites " "for ExpCM.") parser.set_defaults(randprefs=False) parser.add_argument('--randprefs', dest='randprefs', action='store_true', help="Include ExpCM models with randomized preferences.") + parser.set_defaults(omega_random_effects_likelihood=False) + parser.add_argument('--omega_random_effects_likelihood', + dest='omega_random_effects_likelihood', action='store_true', + help="Infer site-specific omega (dN/dS) using the random effects " + "likelihood method.") + parser.add_argument('--REL_ncats', default=50, + type=IntGreaterThanOne, help='Number of categories used ' + 'to integrate the inferred discretized omega distribution for ' + 'the random effects likelihood method.') parser.add_argument('-v', '--version', action='version', version= '%(prog)s {version}'.format(version=phydmslib.__version__)) return parser @@ -414,6 +428,15 @@ def PhyDMSParser(): parser.set_defaults(nograd=False) parser.add_argument('--nograd', dest='nograd', action='store_true', help="Do not use gradients for likelihood maximization.") + parser.set_defaults(omega_random_effects_likelihood=False) + parser.add_argument('--omega_random_effects_likelihood', + dest='omega_random_effects_likelihood', action='store_true', + help="Infer site-specific omega (dN/dS) using the random effects " + "likelihood method.") + parser.add_argument('--REL_ncats', default=50, + type=IntGreaterThanOne, help='The number of categories used ' + 'for the integration of a discretized omega distribution when ' + 'applying a random-effects-likelihood approach.') parser.add_argument('-v', '--version', action='version', version=( ('%(prog)s {version}'.format(version=phydmslib.__version__)))) return parser diff --git a/phydmslib/simulate.py b/phydmslib/simulate.py index ccdb5e59..d7185b15 100644 --- a/phydmslib/simulate.py +++ b/phydmslib/simulate.py @@ -1,4 +1,6 @@ -"""Functions for performing simulations, mostly using ``pyvolve``. +"""Functions for simulating alignments. + +Simulations can be performed by using `pyvolve` partitions or `phydms` models. Written by Jesse Bloom and Sarah Hilton. """ @@ -13,9 +15,193 @@ from tempfile import mkstemp import random import Bio.Phylo +import numpy as np +import copy + + +class Simulator(object): + """Uses a model and a tree to simulate an alignment. + + This class uses the `phydms` models to simulate an alignment. + Most commonly, you will initiate a `Simulator` object and then + simulate an aligment using `Simulator.simulate`. + + See `__init__` for how to initialize a `Simulator`. + + Attributes: + `tree` (instance of `Bio.Phylo.BaseTree.Tree` derived class) + Phylogenetic tree. Branch lengths are in units of codon + substitutions per site for the current `model`. + `model` (instance of `phydmslib.models.Model` derived class) + Specifies the substitution model for `nsites` codon sites. + Only accepts `ExpCM_empirical_phi`, `ExpCM`, `YNGKP_M0` + `nsites` (int) + Number of codon sites. + `root` (instance of `Bio.Phylo.BaseTree.Tree.clade` derived class) + The root of `tree` + + """ + + def __init__(self, tree, model, branchScale=None): + """Initialize a `simulator` object. + + Args: + `tree`, `model` + Attributes of same name described in class doc string. + Note that we make copies of `tree`, and `model`, so + the calling objects are not modified during simulation. + `branchScale` (`None` or float > 0) + The branch lengths in the input tree are assumed + to be in units of substitutions per site with + the scaling defined by `model.branchScale`. If + the scaling should instead be defined by some + other value of `branchScale`, indicate by + setting to that value rather than `None`. This + is useful if tree was inferred on models across + many sites but you are now just analyzing an + individual one. + + """ + if (isinstance(model, phydmslib.models.ExpCM_empirical_phi) + or isinstance(model, phydmslib.models.YNGKP_M0) + or isinstance(model, phydmslib.models.ExpCM)): + self._model = copy.deepcopy(model) + self.nsites = self._model.nsites + else: + raise ValueError(("Model type {0} is not a valid model" + " for simulation".format(model))) + + # Copy over tree assuming units in substitutions per site + assert isinstance(tree, Bio.Phylo.BaseTree.Tree), "invalid tree" + self._tree = copy.deepcopy(tree) + self._root = False + self._internalnode = [] + self._terminalnode = [] + self._seq_array = [] + self._cached_exp_M = {} + self._cached_cumsum = {} + # For internal storage, branch lengths should be in model units + # rather than codon substitutions per site. Here we adjust them from + # For internal storage, branch lengths are in model units rather + # codon substitutions per site to model units. + if branchScale is None: + branchScale = self._model.branchScale + else: + assert isinstance(branchScale, float) and branchScale > 0 + for node in self._tree.find_clades(): + if node != self._tree.root: + node.branch_length /= branchScale # adjust units + if len(node.clades) == 0: # terminal node + self._terminalnode.append(node.name) + else: + self._internalnode.append(node.name) + else: + assert not self._root, "Tree has > 1 root. Please re-root tree" + self._root = node + self._internalnode.append(node.name) + + # set up sequence arrays + for x in range(N_CODON): + site_seq = scipy.zeros(N_CODON) + site_seq[x] = 1 + self._seq_array.append(site_seq) + self._seq_array = scipy.array(self._seq_array) + + def simulate(self, randomSeed=False): + """Simulate an alignment. + + The root sequence is randomly drawn from the stationary + state of the model. To ensure reproducible results, + set the `scipy` random seed with the flag `randomSeed`. + + Attributes: + `randomSeed` (`int` or `False`) + Seed used to set the `scipy` random seed. + Returns: + `simulated_alignment` (`list`) + Final codon alignment. Tuples of (seq_id, seq) for each + terminal node in the tree. -def pyvolvePartitions(model, divselection=None): + """ + def _evolve_branch(parent, child, alignment): + """Generate new sequence given a parent and a child node.""" + branch_len = parent.distance(child) + + if branch_len not in self._cached_exp_M: + self._cached_exp_M[branch_len] = self._model.M(branch_len) + self._cached_cumsum[branch_len] = {} + cached_cumsum = self._cached_cumsum[branch_len] + exp_M = self._cached_exp_M[branch_len] + + new_seq = [] + parent_alignment = alignment[parent.name] + for r in range(self.nsites): + parent_codon = parent_alignment[r] + query = (r, parent_codon) + if query not in cached_cumsum: + cached_cumsum[query] = scipy.cumsum(self._seq_array[parent_codon].dot(exp_M[r])) + cumsum = cached_cumsum[query] + + # choose from the new codon distribution for the site + codon = scipy.argmin(cumsum < scipy.random.rand()) + new_seq.append(codon) + + alignment[child.name] = new_seq + return alignment + + def _traverse_tree(parent, child, alignment): + """Walk along a branch of the tree. + + Calls the `_evolve_branch` function for internal nodes. + """ + if parent is None: # at the root, need to generate a sequence + root_seq = [] + for r in range(self.nsites): + # draw codon from stationary state + ss = self._model.stationarystate[r] + cumsum = scipy.cumsum(ss) + codon = scipy.argmin(cumsum / cumsum[-1] < + scipy.random.rand()) + root_seq.append(codon) + alignment[child.name] = scipy.array(root_seq) + else: # internal branch, need to evolve along the branch + alignment = _evolve_branch(parent, child, alignment) + + # Continue to traverse tree if child is an internal node + if not child.is_terminal(): + for gchild in child.clades: + alignment = _traverse_tree(child, gchild, alignment) + return alignment + + # beginning of `simulate` function + assert randomSeed is None or isinstance(randomSeed, int) + if randomSeed is not False: + scipy.random.seed(randomSeed) + + # set up alignment and begin tree traversal + nodes = self._internalnode + self._terminalnode + alignment = {node: [] for node in nodes} + alignment = _traverse_tree(None, self._root, alignment) + + # reformat the simulated alignment + # turn the sequence arrays into codon sequnces + # format alignment as a list of tuples + simulated_alignment = [] + for node_name in self._terminalnode: + seq = alignment[node_name] + final = [] + for codon in seq: + nt = INDEX_TO_CODON[codon] + final.append(nt) + final = "".join(final) + assert (len(final) / 3) == self.nsites, "Unexpected seq length." + simulated_alignment.append((node_name, final)) + return simulated_alignment + + +# simulations with `pyvolve` +def pyvolvePartitions(model, divselection=None, rateMatrixPrefix=""): """Get list of `pyvolve` partitions for `model`. Args: @@ -33,6 +219,7 @@ def pyvolvePartitions(model, divselection=None): Returns: `partitions` (`list` of `pyvolve.Partition` objects) Can be fed into `pyvolve.Evolver` to simulate evolution. + """ codons = pyvolve.genetics.Genetics().codons codon_dict = pyvolve.genetics.Genetics().codon_dict @@ -67,7 +254,8 @@ def pyvolvePartitions(model, divselection=None): else: fxy *= model.omega if type(model) in [phydmslib.models.ExpCM, - phydmslib.models.ExpCM_empirical_phi, phydmslib.models.ExpCM_empirical_phi_divpressure]: + phydmslib.models.ExpCM_empirical_phi, + phydmslib.models.ExpCM_empirical_phi_divpressure]: qxy *= model.phi[NT_TO_INDEX[ynt]] pix = model.pi[r][AA_TO_INDEX[xaa]]**model.beta piy = model.pi[r][AA_TO_INDEX[yaa]]**model.beta @@ -82,11 +270,15 @@ def pyvolvePartitions(model, divselection=None): matrix[xi][yi] = model.mu * qxy * fxy matrix[xi][xi] = -matrix[xi].sum() - # create model in way that captures annoying print statements in pyvolve + # create model in way that captures `pyvovle` print statements old_stdout = sys.stdout sys.stdout = open(os.devnull, 'w') try: - m = pyvolve.Model("custom", {"matrix":matrix}) + custom_matrix_fname = "{0}custom_matrix_frequencies.txt"\ + .format(rateMatrixPrefix) + m = pyvolve.Model("custom", + {"matrix": matrix}, + save_custom_frequencies=custom_matrix_fname) finally: sys.stdout.close() sys.stdout = old_stdout @@ -94,7 +286,9 @@ def pyvolvePartitions(model, divselection=None): return partitions -def simulateAlignment(model, treeFile, alignmentPrefix, randomSeed=False): + +def simulateAlignment(model, treeFile, alignmentPrefix, + randomSeed=False, nSim=1): """ Simulate an alignment given a model and tree (units = subs/site). @@ -109,22 +303,37 @@ def simulateAlignment(model, treeFile, alignmentPrefix, randomSeed=False): Name of newick file used to simulate the sequences. The branch lengths should be in substitutions per site, which is the default units for all `phydms` outputs. - `alignmentPrefix` + `alignmentPrefix` (str) Prefix for the files created by `pyvolve`. + `randomSeed` (int) + The integer used to seed the random number generator. + `nSim` (int) + The number of replicate simlulations to perform. If no + number is specified than only one simulated alignment will + be created. + + Returns: + `createdAlignments` (`str` or `list` of simulation file names) + A list of the output files created if `nSim` > 1 or the + single output file if `nSim` = 1. + + The result of this function is a simulated FASTA alignment. If `nSim` + is set to 1 or not specified then the simulated alignment will be named + `'{alignmentPrefix}_simulatedalignment.fasta'`. Otherwise, there will be + an alignment named `'{alignmentPrefix}_{rep}_simulatedalignment.fasta'` + for `rep` in `range(nSim)`. - The result of this function is a simulated FASTA alignment - file with the name having the prefix giving by `alignmentPrefix` - and the suffix `'_simulatedalignment.fasta'`. """ - if randomSeed == False: + if randomSeed is False: pass else: random.seed(randomSeed) + np.random.seed(randomSeed) - #Transform the branch lengths by dividing by the model `branchScale` + # Transform the branch lengths by dividing by the model `branchScale` tree = Bio.Phylo.read(treeFile, 'newick') for node in tree.get_terminals() + tree.get_nonterminals(): - if (node.branch_length == None) and (node == tree.root): + if (node.branch_length is None) and (node == tree.root): node.branch_length = 1e-06 else: node.branch_length /= model.branchScale @@ -134,20 +343,39 @@ def simulateAlignment(model, treeFile, alignmentPrefix, randomSeed=False): pyvolve_tree = pyvolve.read_tree(file=temp_path) os.remove(temp_path) + # Make the `pyvolve` partition + partitions = pyvolvePartitions(model, rateMatrixPrefix=alignmentPrefix) - #Make the `pyvolve` partition - partitions = pyvolvePartitions(model) + createdAlignments = [] + for rep in range(nSim): + # Simulate the alignment + alignment = '{0}_{1}_simulatedalignment.fasta'\ + .format(alignmentPrefix, rep) + info = '_temp_{0}info.txt'.format(alignmentPrefix) + rates = '_temp_{0}_ratefile.txt'.format(alignmentPrefix) + custom_matrix = '{0}custom_matrix_frequencies.txt'\ + .format(alignmentPrefix) + evolver = pyvolve.Evolver(partitions=partitions, tree=pyvolve_tree) + evolver(seqfile=alignment, infofile=info, ratefile=rates) + # Clean up extraneous `pyvovle` simulations + for f in [rates, info, custom_matrix]: + if os.path.isfile(f): + os.remove(f) + assert os.path.isfile(alignment) + createdAlignments.append(alignment) - #Simulate the alignment - alignment = '{0}_simulatedalignment.fasta'.format(alignmentPrefix) - info = '_temp_{0}info.txt'.format(alignmentPrefix) - rates = '_temp_{0}_ratefile.txt'.format(alignmentPrefix) - evolver = pyvolve.Evolver(partitions=partitions, tree=pyvolve_tree) - evolver(seqfile=alignment, infofile=info, ratefile=rates) - for f in [rates,info, "custom_matrix_frequencies.txt"]: - if os.path.isfile(f): - os.remove(f) - assert os.path.isfile(alignment) + # Make sure all of the expected output files exist + if nSim == 1: + # Re-name files if only one replicate is specified + createdAlignments = ['{0}_simulatedalignment.fasta' + .format(alignmentPrefix)] + os.rename(alignment, createdAlignments[0]) + assert os.path.isfile(createdAlignments[0]),\ + "Failed to created file {0}".format(createdAlignments[0]) + else: + for f in createdAlignments: + assert os.path.isfile(f), "Failed to created file {0}".format(f) + return createdAlignments if __name__ == '__main__': diff --git a/pytest.ini b/pytest.ini index c7878fa0..852fc3de 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,5 @@ [pytest] addopts = --ignore setup.py --doctest-modules --ignore=docs/plot_diffprefs_prior.py --ignore=tests/test_diffprefsbysite.py --ignore=tests/test_prepalignment.py # ignore script to create docs plot, requires `LaTeX` +filterwarnings = + ignore::DeprecationWarning diff --git a/scripts/phydms b/scripts/phydms index 9e30d375..79c487dd 100644 --- a/scripts/phydms +++ b/scripts/phydms @@ -17,6 +17,7 @@ import multiprocessing import warnings warnings.simplefilter('always') warnings.simplefilter('ignore', ImportWarning) +import pandas as pd import numpy import scipy import scipy.stats @@ -130,7 +131,7 @@ def fitOmegaBySite(argtup): `argtup` is return value of `treeliksForOmegaBySite`. Returns tuple `(pval, omega, resultstr)` where `pval` is P-value, - `omega` is omega, and `resultstr` is tab-separated line with + `omega` is omega, and `resultstr` is tab-separated line with site, omega, P, dLnL. """ (site, treeliks, nograd) = argtup @@ -179,8 +180,10 @@ def main(): treefile = '{0}{1}tree.newick'.format(args['outprefix'], underscore) omegafile = '{0}{1}omegabysite.txt'.format(args['outprefix'], underscore) diffprefsfile = '{0}{1}diffprefsbysite.txt'.format(args['outprefix'], underscore) + relomegafile = '{0}{1}omegabycategory.csv'.format(args['outprefix'], underscore) + relprobabilityfile = '{0}{1}posteriorprobabilities.csv'.format(args['outprefix'], underscore) to_remove = [modelparamsfile, loglikelihoodfile, treefile, omegafile, - logfile, diffprefsfile] + logfile, diffprefsfile, relomegafile, relprobabilityfile] for f in to_remove: if os.path.isfile(f): os.remove(f) @@ -244,7 +247,7 @@ def main(): model = phydmslib.models.YNGKP_M0(e_pw, nsites, freeparams= ['mu', 'omega', 'kappa']) if modelvariant == 'M0': - pass + assert not args['omega_random_effects_likelihood'], "'--omega_random_effects_likelihood' incompatible with YNKGP_M0. Please specify the YNGKP_M5 model." elif modelvariant == 'M5': logger.info(('For this {0} model, omega will be drawn from ' '{1} gamma-distributed categories.').format( @@ -260,6 +263,8 @@ def main(): prefsfile = args['model'][1] logger.info(('The model will be an ExpCM informed by site-specific ' 'amino-acid preferences in {0}').format(prefsfile)) + if args['omega_random_effects_likelihood']: + assert args['gammaomega'], "For ExpCM, --omega_random_effects_likelihood must be called with --gammaomega" for (argname, desc) in [('avgprefs', 'averaged'), ('randprefs', 'randomized')]: if args[argname]: @@ -538,6 +543,76 @@ def main(): f.write('\n'.join([tup[1] for tup in sorted(diffprefresults, reverse=True)])) + # given a distribution of omega values, compute posterior probabilities + if args['omega_random_effects_likelihood']: + # set up models + if isinstance(args['model'], str) and \ + yngkp_match.search(args['model']) and \ + modelvariant == 'M5': + # Reconstruct YNGKP_M5 with fit model parameters + model = phydmslib.models.YNGKP_M0( + e_pw, nsites=tl.model.nsites, kappa=tl.model.kappa, + freeparams=['mu', 'omega', 'kappa']) + elif args['model'][0] == 'ExpCM': + # Reconstruct ExpCM with fit model parameters + model = phydmslib.models.ExpCM_empirical_phi( + prefslist, g, kappa=tl.model.kappa, beta=tl.model.beta, + freeparams=['mu', 'omega']) + else: + raise ValueError('model {0} incompatible with random-effects-likelihood method.'.format(args['model'])) + logger.info('Distribution of omega values will be integrated ' + 'with {0} discrete categories.' + .format(args['REL_ncats'])) + omegas = phydmslib.models.DiscreteGamma(tl.model.alpha_lambda, + tl.model.beta_lambda, + args['REL_ncats']) + assert len(omegas) == args['REL_ncats'] + logger.info('Constructing a substitution model for each ' + 'discrete category.') + # For each omega value, list of likelihoods by site + df = {} + for omega in omegas: + # omega must be within the correct range + omega = max(min(model.PARAMLIMITS['omega'][1], omega), + model.PARAMLIMITS['omega'][0]) + model.updateParams({'omega': omega}) + assert model.omega == omega + # log likelihood by site + treeliks = (phydmslib.treelikelihood.TreeLikelihood(tree, + alignment, + model) + .siteloglik) + assert len(treeliks) == model.nsites + # likelihood by site + treeliks = numpy.exp(treeliks) + # if an omega value is repeated, sum likelihoods + df[omega] = (treeliks if omega not in df.keys() + else df[omega] + treeliks) + df = pd.DataFrame(df) + logger.info('There are {0} category(ies) whose omega value is ' + 'greater than one.' + .format(str(sum(i > 1 for i in omegas)))) + logger.info('Computing posterior probabilities of positive ' + 'selection for each site.') + # posterior_k = likelihood_k / sum(likelihoods), all by site + df = df.div(df.sum(axis=1), axis=0) + # Sum of posterior probabilities for each site must be 1 + assert numpy.allclose(df.sum(axis=1), 1) + # probability of omega greater than 1 + target_omegas = [x for x in df.columns.values if x > 1] + df['p(omega > 1)'] = df[target_omegas].sum(axis=1) + df.insert(0, 'site', range(1, model.nsites + 1)) + + # output files + relomega = (pd.melt(df.drop(columns='p(omega > 1)'), + id_vars=['site'], var_name='omega', + value_name='post_probability') + .to_csv(relomegafile, index=False)) + relprobability = (df[['site', 'p(omega > 1)']] + .sort_values(by='p(omega > 1)', + ascending=False) + .to_csv(relprobabilityfile, index=False)) + except: logger.exception('Terminating {0} at {1} with ERROR'.format(prog, time.asctime())) raise diff --git a/scripts/phydms_comprehensive b/scripts/phydms_comprehensive index 69f613c4..00c356f4 100644 --- a/scripts/phydms_comprehensive +++ b/scripts/phydms_comprehensive @@ -133,7 +133,8 @@ def main(): '_modelparams.txt'] filesuffixes = {} # keyed by model, values are list of suffixes models = {} - additionalcmds = ["--brlen", args["brlen"]] + additionalcmds = ["--brlen", args["brlen"], + '--minbrlen', str(args['minbrlen'])] if args['omegabysite']: additionalcmds.append('--omegabysite') filesuffixlist = copy.deepcopy(filesuffixlist) + ['_omegabysite.txt'] @@ -141,8 +142,15 @@ def main(): #set up the YNGKP models models = {'YNGKP_M0':('YNGKP_M0', additionalcmds)} filesuffixes['YNGKP_M0'] = filesuffixlist - models['YNGKP_M5'] = ('YNGKP_M5', additionalcmds) - filesuffixes['YNGKP_M5'] = filesuffixlist + if args['omega_random_effects_likelihood']: + models['YNGKP_M5'] = ( + 'YNGKP_M5', additionalcmds + ['--omega_random_effects_likelihood'] + + ['--REL_ncats'] + [str(args['REL_ncats'])]) + filesuffixes['YNGKP_M5'] = copy.deepcopy(filesuffixlist) + \ + ['_omegabycategory.csv'] + ['_posteriorprobabilities.csv'] + else: + models['YNGKP_M5'] = ('YNGKP_M5', additionalcmds) + filesuffixes['YNGKP_M5'] = filesuffixlist #set up the ExpCM additionalcmds = copy.deepcopy(additionalcmds) @@ -162,9 +170,21 @@ def main(): models[modelname] = ('ExpCM_{0}'.format(prefsfile), additionalcmds) if args["gammaomega"]: gammaomegamodelname = '{0}_gammaomega'.format(modelname) - models[gammaomegamodelname] = ('ExpCM_{0}'.format(prefsfile), - additionalcmds + ['--gammaomega']) - filesuffixes[gammaomegamodelname] = filesuffixlist + if args['omega_random_effects_likelihood']: + models[gammaomegamodelname] = ( + 'ExpCM_{0}'.format(prefsfile), additionalcmds + + ['--gammaomega'] + ['--ncats'] + [str(args['ncats'])] + + ['--omega_random_effects_likelihood'] + ['--REL_ncats'] + + [str(args['REL_ncats'])]) + filesuffixes[gammaomegamodelname] = \ + copy.deepcopy(filesuffixlist) + \ + ['_omegabycategory.csv'] + ['_posteriorprobabilities.csv'] + else: + models[gammaomegamodelname] = ( + 'ExpCM_{0}'.format(prefsfile), + additionalcmds + ['--gammaomega'] + ['--ncats'] + + [str(args['ncats'])]) + filesuffixes[gammaomegamodelname] = filesuffixlist if args["gammabeta"]: gammabetamodelname = '{0}_gammabeta'.format(modelname) models[gammabetamodelname] = ('ExpCM_{0}'.format(prefsfile), @@ -177,10 +197,21 @@ def main(): filesuffixes[avgmodelname] = filesuffixlist if args["gammaomega"]: avgmodelname = 'averaged_{0}_gammaomega'.format(modelname) - models[avgmodelname] = ('ExpCM_{0}'.format(prefsfile), - additionalcmds + ['--gammaomega'] \ - + ['--avgprefs'], 0) - filesuffixes[avgmodelname] = filesuffixlist + if args['omega_random_effects_likelihood']: + models[avgmodelname] = ( + 'ExpCM_{0}'.format(prefsfile), additionalcmds + + ['--gammaomega'] + ['--ncats'] + [str(args['ncats'])] + + ['--avgprefs'] + ['--omega_random_effects_likelihood'] + + ['--REL_ncats'] + [str(args['REL_ncats'])], 0) + filesuffixes[avgmodelname] = \ + copy.deepcopy(filesuffixlist) + \ + ['_omegabycategory.csv'] + \ + ['_posteriorprobabilities.csv'] + else: + models[avgmodelname] = ('ExpCM_{0}'.format(prefsfile), + additionalcmds + ['--gammaomega'] + ['--ncats'] + + [str(args['ncats'])] + ['--avgprefs'], 0) + filesuffixes[avgmodelname] = filesuffixlist if args["gammabeta"]: avgmodelname = 'averaged_{0}_gammabeta'.format(modelname) models[avgmodelname] = ('ExpCM_{0}'.format(prefsfile), @@ -194,10 +225,21 @@ def main(): filesuffixes[randmodelname] = filesuffixlist if args["gammaomega"]: randmodelname = 'randomized_{0}_gammaomega'.format(modelname) - models[randmodelname] = ('ExpCM_{0}'.format(prefsfile), - additionalcmds + ['--gammaomega'] \ - + ['--randprefs'], 0) - filesuffixes[randmodelname] = filesuffixlist + if args['omega_random_effects_likelihood']: + models[randmodelname] = ( + 'ExpCM_{0}'.format(prefsfile), additionalcmds + + ['--gammaomega'] + ['--ncats'] + [str(args['ncats'])] + + ['--randprefs'] + ['--omega_random_effects_likelihood'] + + ['--REL_ncats'] + [str(args['REL_ncats'])], 0) + filesuffixes[randmodelname] = \ + copy.deepcopy(filesuffixlist) + \ + ['_omegabycategory.csv'] + \ + ['_posteriorprobabilities.csv'] + else: + models[randmodelname] = ('ExpCM_{0}'.format(prefsfile), + additionalcmds + ['--gammaomega'] + ['--ncats'] + + [str(args['ncats'])] + ['--randprefs'], 0) + filesuffixes[randmodelname] = filesuffixlist if args["gammabeta"]: randmodelname = 'randomized_{0}_gammabeta'.format(modelname) models[randmodelname] = ('ExpCM_{0}'.format(prefsfile), diff --git a/scripts/phydms_divpressure b/scripts/phydms_divpressure index 472a9292..749e36c7 100644 --- a/scripts/phydms_divpressure +++ b/scripts/phydms_divpressure @@ -5,8 +5,6 @@ Written by Jesse Boom and Sarah Hilton. """ - -import sys import os import re import time @@ -20,14 +18,16 @@ import phydmslib.parsearguments import pandas as pd import random -def randomizeDivpressure(divpressureFile,numberRandomizations,outprefix): + +def randomizeDivpressure(divpressureFile, numberRandomizations, outprefix): """ This function randomizes a diversfiying pressure list the number of times specfied by the user. Each randomization is written to a new diversifying pressures files in the directory 'randomizedFiles'. The function returns a dictionary of file names keyed by the random seed. """ - divpressurefilebase = os.path.splitext(os.path.basename(divpressureFile))[0] + divpressurefilebase = (os.path.splitext( + os.path.basename(divpressureFile))[0]) outdir = os.path.dirname(outprefix+"randomizedFiles/") if outdir: if not os.path.isdir(outdir): @@ -41,15 +41,16 @@ def randomizeDivpressure(divpressureFile,numberRandomizations,outprefix): for seed in range(int(numberRandomizations)): random.seed(seed) random.shuffle(divpressures) - randomDivpressureFile = outdir+'/{0}_random_{1}.csv'\ - .format(divpressurefilebase, seed) + randomDivpressureFile = (outdir+'/{0}_random_{1}.csv' + .format(divpressurefilebase, seed)) with open(randomDivpressureFile, 'w') as f: f.write("#SITE,VALUE\n") - f.write('\n'.join('{0},{1}'.format(site, dp) for (site, dp) \ + f.write('\n'.join('{0},{1}'.format(site, dp) for (site, dp) in zip(sites, divpressures))) randomFiles[seed] = randomDivpressureFile return randomFiles + def createModelComparisonFile(models, outprefix): """ Creates two summary files, a .csv and a .md @@ -75,62 +76,67 @@ def createModelComparisonFile(models, outprefix): and all optimized parameters. Only the non-randomized `phydms` runs are included. """ - - #modelcomparison.csv - final = pd.DataFrame({"Preferences":[],"DiversifyingPressureSet":[], - "DiversifyingPressureType":[],"DiversifyingPressureID":[], - "variable":[], "value":[]}) + # modelcomparison.csv + final = pd.DataFrame({"Preferences": [], "DiversifyingPressureSet": [], + "DiversifyingPressureType": [], + "DiversifyingPressureID": [], + "variable": [], "value": []}) for modelID in models.keys(): - outFilePrefix = "ExpCM_" + '_'.join(str(item) for item in modelID\ - if item != "None") - df = pd.read_csv(outprefix + outFilePrefix + "_modelparams.txt", - sep = " = ", header = None, engine = 'python') - df.columns = ['variable', 'value'] #rename the columns + outFilePrefix = ("ExpCM_" + '_'.join(str(item) for item in modelID + if item != "None")) + df = pd.read_csv("{0}{1}_modelparams.txt" + .format(outprefix, outFilePrefix), + sep=" = ", header=None, engine='python') + df.columns = ['variable', 'value'] # rename the columns df["Preferences"] = [modelID[0] for x in range(len(df))] df["DiversifyingPressureSet"] = [modelID[1] for x in range(len(df))] df["DiversifyingPressureType"] = [modelID[2] for x in range(len(df))] - df["DiversifyingPressureID"] = [modelID[1] + "_" + str(modelID[3]) \ - for x in range(len(df))] + df["DiversifyingPressureID"] = [modelID[1] + "_" + str(modelID[3]) + for x in range(len(df))] final = pd.concat([final, df], sort=True) with open(outprefix + outFilePrefix + "_loglikelihood.txt") as f: - temp = {"Preferences":[],"DiversifyingPressureSet":[], - "DiversifyingPressureType":[],"DiversifyingPressureID":[], - "variable":[], "value":[]} + temp = {"Preferences": [], "DiversifyingPressureSet": [], + "DiversifyingPressureType": [], + "DiversifyingPressureID": [], "variable": [], "value": []} lines = f.readlines() temp["Preferences"] = [modelID[0]] temp["DiversifyingPressureSet"] = [modelID[1]] temp["DiversifyingPressureType"] = [modelID[2]] - temp["DiversifyingPressureID"] = [modelID[1] + "_" + str(modelID[3])] + temp["DiversifyingPressureID"] = ["{0}_{1}".format(modelID[1], + str(modelID[3])) + ] temp["variable"].append("LogLikelihood") temp["value"].append(lines[0].split(" = ")[-1]) final = pd.concat([final, pd.DataFrame(temp)]) - final.to_csv(outprefix + "modelcomparison.csv", index = False) - final.reset_index(drop=True, inplace = True) - - - #modelcomparison.md - #pivot the dataframe so the parameters are columns - mdDF = final[final["DiversifyingPressureType"] != "Random"]\ - .pivot(index = "DiversifyingPressureSet", columns='variable', - values='value') + final.to_csv("{0}modelcomparison.csv".format(outprefix), index=False) + final.reset_index(drop=True, inplace=True) + + # modelcomparison.md + # pivot the dataframe so the parameters are columns + mdDF = (final[final["DiversifyingPressureType"] != "Random"] + .pivot(index="DiversifyingPressureSet", columns='variable', + values='value')) mdDF = mdDF[[x for x in mdDF.columns.values]] with open(outprefix + "modelcomparison.md", "w") as f: - f.write("|".join(["DiversifyingPressureSet"] \ - + list(mdDF.columns.values)) + "\n") + f.write("|".join(["DiversifyingPressureSet"] + + list(mdDF.columns.values)) + "\n") f.write("".join(["---|" for x in range(len(mdDF.columns.values))] + ["---"]) + "\n") for index, row in mdDF.iterrows(): - f.write("|".join([str(x) for x in [index]+ list(row)]) + "\n") + f.write("|".join([str(x) for x in [index] + list(row)]) + "\n") + def RunCmds(cmds): """Runs the command line arguments in *cmds* using *subprocess*.""" try: - p = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + p = subprocess.Popen(cmds, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) pid = p.pid (stdout, stderr) = p.communicate() except: os.kill(pid, signal.SIGTERM) + def main(): """ Main body of script. @@ -148,11 +154,11 @@ def main(): (pref file, list of `phydms` commands, number of empirical parameters, modelprefix) - The branch lengths are optimized using `ExpCM` without diversifying pressure - on either the tree specfied by the user or the tree inferred under the - *GTRCAT* with `RAxML`. The `ExpCM` with diversifying pressures are run with - this optimized tree and the branch lengths are scaled but not individually - optimized. + The branch lengths are optimized using `ExpCM` without diversifying + pressure on either the tree specfied by the user or the tree inferred under + the *GTRCAT* with `RAxML`. The `ExpCM` with diversifying pressures are run + with this optimized tree and the branch lengths are scaled but not + individually optimized. """ # Parse command line arguments @@ -160,7 +166,7 @@ def main(): args = vars(parser.parse_args()) prog = parser.prog - #create output directory if needed + # create output directory if needed outdir = os.path.dirname(args['outprefix']) if outdir: if not os.path.isdir(outdir): @@ -168,72 +174,71 @@ def main(): os.remove(outdir) os.mkdir(outdir) - #setup files - #file names depend on whether outprefix is directory or file + # setup files + # file names depend on whether outprefix is directory or file if args['outprefix'][-1] == '/': logfile = "{0}log.log".format(args['outprefix']) else: logfile = "{0}.log".format(args['outprefix']) args['outprefix'] = '{0}_'.format(args['outprefix']) - modelcomparisonfile = '{0}modelcomparison.txt'.format(args['outprefix']) raxmlStandardOutputFile = '{0}ramxl_output.txt'.format(args['outprefix']) - #Set up to log everything to logfile. - # Set up to log everything to logfile. + # Set up to log everything to logfile. + # Set up to log everything to logfile. if os.path.isfile(logfile): os.remove(logfile) logging.shutdown() logging.captureWarnings(True) versionstring = phydmslib.file_io.Versions() logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', - level=logging.INFO) + level=logging.INFO) logger = logging.getLogger(prog) logfile_handler = logging.FileHandler(logfile) logger.addHandler(logfile_handler) formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') logfile_handler.setFormatter(formatter) - #print some basic information + # print some basic information logger.info('Beginning execution of {0} in directory {1}\n' - .format(prog, os.getcwd())) + .format(prog, os.getcwd())) logger.info('Progress is being logged to {0}\n'.format(logfile)) logger.info('{0}\n'.format(versionstring)) logger.info('Parsed the following command-line arguments:\n{0}\n' - .format('\n'.join(['\t{0} = {1}'.format(key, args[key]) - for key in args.keys()]))) + .format('\n'.join(['\t{0} = {1}'.format(key, args[key]) + for key in args.keys()]))) - #Set up to log everything to logfile. + # Set up to log everything to logfile. if os.path.isfile(logfile): os.remove(logfile) logging.shutdown() versionstring = phydmslib.file_io.Versions() logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', - level=logging.INFO) + level=logging.INFO) logger = logging.getLogger(prog) logfile_handler = logging.FileHandler(logfile) logger.addHandler(logfile_handler) formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') logfile_handler.setFormatter(formatter) - #print some basic information + # print some basic information logger.info('Beginning execution of {0} in directory {1}\n' - .format(prog, os.getcwd())) + .format(prog, os.getcwd())) logger.info('Progress is being logged to {0}\n'.format(logfile)) logger.info('{0}\n'.format(versionstring)) logger.info('Parsed the following command-line arguments:\n{0}\n' - .format('\n'.join(['\t{0} = {1}'.format(key, args[key]) - for key in args.keys()]))) + .format('\n'.join(['\t{0} = {1}'.format(key, args[key]) + for key in args.keys()]))) - #setup models + # setup models filesuffixlist = ['_log.log', '_tree.newick', '_loglikelihood.txt', - '_modelparams.txt'] - filesuffixes = {} # keyed by model, values are list of suffixes + '_modelparams.txt'] + filesuffixes = {} # keyed by model, values are list of suffixes models = {} - #set up the ExpCM without diversifying pressure + # set up the ExpCM without diversifying pressure expcmadditionalcmds = [] nempiricalExpCM = 3 - if re.search('\s', args['prefsfile']): + if re.search(r'\s', args['prefsfile']): raise ValueError("There is a space in the preferences file name:\ {0}".format(args['prefsfile'])) prefsfilebase = os.path.splitext(os.path.basename(args['prefsfile']))[0] @@ -241,60 +246,69 @@ def main(): assert modelID not in filesuffixes, "Duplicate model ID" filesuffixes[modelID] = filesuffixlist models[modelID] = ('ExpCM_{0}'.format(args['prefsfile']), - expcmadditionalcmds, nempiricalExpCM, "ExpCM_" + '_'.join(str(item)\ - for item in modelID if item != "None")) + expcmadditionalcmds, + nempiricalExpCM, + "ExpCM_" + '_'.join(str(item) for item in modelID + if item != "None")) - #set up ExpCM with diversifying pressure + # set up ExpCM with diversifying pressure for divpressure in args["divpressure"]: - divpressurefilebase = os.path.splitext(os.path.basename(divpressure))[0] + divpressurefilebase = (os.path.splitext( + os.path.basename(divpressure))[0]) modelID = (prefsfilebase, divpressurefilebase, "True", "None") assert modelID not in filesuffixes, "Duplicate model ID (divpressure)" filesuffixes[modelID] = filesuffixlist models[modelID] = ('ExpCM_{0}'.format(args['prefsfile']), - expcmadditionalcmds + ["--divpressure", divpressure], - nempiricalExpCM, "ExpCM_" + '_'.join(str(item) for item\ - in modelID if item != "None")) - #set up ExpCM with diversifying pressure randomizations + expcmadditionalcmds + ["--divpressure", + divpressure], + nempiricalExpCM, + "ExpCM_" + '_'.join(str(item) for item in modelID + if item != "None")) + # set up ExpCM with diversifying pressure randomizations if args["randomizations"]: randomFiles = randomizeDivpressure(divpressure, - args["randomizations"], args["outprefix"]) - for random in randomFiles.keys(): - modelID = (prefsfilebase, divpressurefilebase, "Random", random) - assert modelID not in filesuffixes, "Duplicate model ID (divpressure)" + args["randomizations"], + args["outprefix"]) + for i in randomFiles.keys(): + modelID = (prefsfilebase, divpressurefilebase, + "Random", i) + assert modelID not in filesuffixes,\ + "Duplicate model ID (divpressure)" filesuffixes[modelID] = filesuffixlist models[modelID] = ('ExpCM_{0}'.format(args['prefsfile']), - expcmadditionalcmds + ["--divpressure", randomFiles[random]], - nempiricalExpCM, "ExpCM_" + '_'.join(str(item) for item\ - in modelID if item != "None")) + expcmadditionalcmds + ["--divpressure", + randomFiles[i]], + nempiricalExpCM, + "ExpCM_" + '_'.join(str(item) for item + in modelID if item + != "None")) # check alignment logger.info('Checking that the alignment {0} is valid...' - .format(args['alignment'])) + .format(args['alignment'])) alignment = phydmslib.file_io.ReadCodonAlignment(args['alignment'], - checknewickvalid=True) #checks that the identifiers are unique - assert len(set([align[1] for align in alignment])) == len([align[1] - for align in alignment]), "Remove duplicate sequences from {0}."\ - .format(args["alignment"]) + checknewickvalid=True) + assert (len(set([align[1] for align in alignment])) == + len([align[1] for align in alignment])),\ + "Remove duplicate sequences from {0}.".format(args["alignment"]) logger.info('Valid alignment specifying {0} sequences of length {1}.\n' - .format(len(alignment), len(alignment[0][1]))) + .format(len(alignment), len(alignment[0][1]))) - - #read or build a tree + # read or build a tree if args["tree"]: - logger.info("Reading tree from {0}".format(args['tree'])) + logger.info("Reading tree from {0}".format(args['tree'])) else: logger.info("Tree not specified.") try: - raxmlversion = subprocess.check_output([args['raxml'], '-v'], - stderr=subprocess.STDOUT).strip() logger.info("Inferring tree with RAxML using command {0}" - .format(args['raxml'])) + .format(args['raxml'])) - #remove pre-existing RAxML files + # remove pre-existing RAxML files raxmlOutputName = os.path.splitext(os.path.basename( args["alignment"]))[0] raxmlOutputFiles = [n for n in glob.glob("RAxML_*{0}" - .format(raxmlOutputName)) if os.path.isfile(n)] + .format(raxmlOutputName)) + if os.path.isfile(n)] raxmlOutputFiles = [] for raxmlFile in glob.glob("RAxML_*{0}".format(raxmlOutputName)): if os.path.isfile(raxmlFile): @@ -302,14 +316,14 @@ def main(): os.remove(raxmlFile) if len(raxmlOutputFiles) > 0: logger.info('Removed the following RAxML files:\n{0}\n' - .format('\n'.join(['\t{0}'.format(fname) for - fname in raxmlOutputFiles]))) + .format('\n'.join(['\t{0}'.format(fname) for + fname in raxmlOutputFiles]))) # run RAxmL raxmlCMD = [args['raxml'], '-s', args['alignment'], '-n', - raxmlOutputName, '-m', 'GTRCAT', '-p1', '-T', '2'] + raxmlOutputName, '-m', 'GTRCAT', '-p1', '-T', '2'] with open(raxmlStandardOutputFile, 'w') as f: - subprocess.check_call(raxmlCMD, stdout = f) + subprocess.check_call(raxmlCMD, stdout=f) # move RAxML tree to output directory and remove all other files for raxmlFile in glob.glob("RAxML_*{0}".format(raxmlOutputName)): @@ -322,34 +336,36 @@ def main(): os.remove(raxmlFile) except OSError: raise ValueError("The raxml command of {0} is not valid." - " Is raxml installed at this path?".format(args['raxml'])) + " Is raxml installed at this path?" + .format(args['raxml'])) - #setting up cpus + # setting up cpus if args['ncpus'] == -1: try: args['ncpus'] = multiprocessing.cpu_count() except: raise RuntimeError("Encountered a problem trying to dynamically" - "determine the number of available CPUs. Please manually" - " specify the number of desired CPUs with '--ncpus' and" - " try again.") + "determine the number of available CPUs. " + "Please manually specify the number of desired " + "CPUs with '--ncpus' and try again.") logger.info('Will use all %d available CPUs.\n' % args['ncpus']) assert args['ncpus'] >= 1, "Failed to specify valid number of CPUs" - #Each model gets at least 1 CPU + # Each model gets at least 1 CPU ncpus_per_model = {} nperexpcm = max(1, (args['ncpus'] - 2) // len(models)) for modelID in models.keys(): ncpus_per_model[modelID] = nperexpcm mtup = models[modelID] - assert len(mtup) == 4 # should be 3-tuple + assert len(mtup) == 4 # should be 3-tuple models[modelID] = (mtup[0], mtup[1] + ['--ncpus', - str(ncpus_per_model[modelID])], mtup[2], mtup[3]) + str(ncpus_per_model[modelID])], + mtup[2], mtup[3]) - pool = {} # holds process for model name - started = {} # holds whether process started for model name - completed = {} # holds whether process completed for model name - outprefixes = {} # holds outprefix for model name + pool = {} # holds process for model name + started = {} # holds whether process started for model name + completed = {} # holds whether process completed for model name + outprefixes = {} # holds outprefix for model name # rest of execution in try / finally try: @@ -359,7 +375,8 @@ def main(): removed = [] for modelID in models.keys(): for suffix in filesuffixes[modelID]: - fname = "{0}{1}{2}".format(args['outprefix'], models[modelID][3], suffix) + fname = "{0}{1}{2}".format(args['outprefix'], + models[modelID][3], suffix) outfiles.append(fname) for fname in outfiles: if os.path.isfile(fname): @@ -367,11 +384,11 @@ def main(): removed.append(fname) if removed: logger.info('Removed the following existing files that have names' - " that match the names of output files that will be " - 'created: {0}\n'.format(', '.join(removed))) + " that match the names of output files that will be " + 'created: {0}\n'.format(', '.join(removed))) # first run the `ExpCM` model without diversiying pressure to optimize - #the branch lengths + # the branch lengths noDivPressure = [x for x in list(models.keys()) if x[1] == "None"] assert len(noDivPressure) == 1, "More than one ExpCM without\ diversifying pressure was specified" @@ -380,32 +397,33 @@ def main(): outprefix = "{0}{1}".format(args['outprefix'], modelname) cmds = ['phydms', args['alignment'], args["tree"], model, outprefix] + additionalcmds + ["--brlen", "optimize"] - logger.info('Starting analysis. Optimizing the branch lengths. The command is: %s\n' % (' '.join(cmds))) + logger.info('Starting analysis. Optimizing the branch lengths. The ' + 'command is: %s\n' % (' '.join(cmds))) outprefixes[noDivPressure] = outprefix subprocessOutput = '{0}subprocess_output.txt'.format(args['outprefix']) with open(subprocessOutput, 'w') as f: - subprocess.check_call(cmds, stdout = f) + subprocess.check_call(cmds, stdout=f) if os.path.isfile(subprocessOutput): os.remove(subprocessOutput) for fname in [outprefixes[noDivPressure] + suffix for suffix - in filesuffixes[noDivPressure]]: + in filesuffixes[noDivPressure]]: if not os.path.isfile(fname): raise RuntimeError("phydms failed to created" - " expected output file {0}.".format(fname)) - logger.info('Analysis successful for {0} without diversifying pressure.\n'\ - .format(modelID[0])) + " expected output file {0}.".format(fname)) + logger.info('Analysis successful for {0} without diversifying ' + 'pressure.\n'.format(modelID[0])) treeFile = '{0}_tree.newick'.format(outprefix) assert os.path.isfile(treeFile) - #now run the other models + # now run the other models divPressureModels = [x for x in list(models.keys()) if x[1] != "None"] for modelID in divPressureModels: (model, additionalcmds, nempirical, modelname) = models[modelID] outprefix = "{0}{1}".format(args['outprefix'], modelname) cmds = ['phydms', args['alignment'], treeFile, model, outprefix] + additionalcmds + ["--brlen", "scale"] - pool[modelID] = multiprocessing.Process(target=RunCmds\ - , args=(cmds,)) + pool[modelID] = multiprocessing.Process(target=RunCmds, + args=(cmds,)) outprefixes[modelID] = outprefix completed[modelID] = False started[modelID] = False @@ -420,30 +438,36 @@ def main(): break for (modelID, p) in pool.items(): if started[modelID] and (not completed[modelID]) and \ - (not p.is_alive()): # process just completed + (not p.is_alive()): # process just completed completed[modelID] = True for fname in [outprefixes[modelID] + suffix for suffix - in filesuffixes[modelID]]: + in filesuffixes[modelID]]: if not os.path.isfile(fname): raise RuntimeError("phydms failed to created" - " expected output file {0}.".format(fname)) + " expected output file {0}." + .format(fname)) if modelID[1] != "None": if modelID[2] != "True": - logger.info('Analysis successful for {0} with diversifying pressure {1} and random seed {2}\n'\ - .format(modelID[0], modelID[1], modelID[3])) + logger.info('Analysis successful for {0} with ' + 'diversifying pressure {1} and random ' + 'seed {2}\n'.format(modelID[0], + modelID[1], + modelID[3])) else: - logger.info('Analysis successful for {0} with diversifying pressure {1}\n'\ - .format(modelID[0], modelID[1])) + logger.info('Analysis successful for {0} with ' + 'diversifying pressure {1}\n' + .format(modelID[0], modelID[1])) else: - logger.info('Analysis successful for {0} without diversifying pressure.\n'\ - .format(modelID[0])) + logger.info('Analysis successful for {0} without ' + 'diversifying pressure.\n' + .format(modelID[0])) time.sleep(1) - #make sure all expected output files are there + # make sure all expected output files are there for fname in outfiles: if not os.path.isfile(fname): raise RuntimeError("Cannot find expected output file {0}" - .format(fname)) + .format(fname)) createModelComparisonFile(models, args["outprefix"]) for fname in outfiles: if os.path.isfile(fname): @@ -452,10 +476,9 @@ def main(): for f in glob.glob(args["outprefix"] + "randomizedFiles/*"): os.remove(f) os.rmdir(args["outprefix"] + "randomizedFiles/") - except: logger.exception('Terminating {0} at {1} with ERROR' - .format(prog, time.asctime())) + .format(prog, time.asctime())) else: logger.info('Successful completion of {0}'.format(prog)) finally: @@ -466,7 +489,7 @@ def main(): if __name__ == '__main__': - main() # run the script + main() # run the script -#make the test script -#figure out why the logging prints twice +# make the test script +# figure out why the logging prints twice diff --git a/scripts/phydms_logoplot b/scripts/phydms_logoplot index 415d910c..9cb16176 100644 --- a/scripts/phydms_logoplot +++ b/scripts/phydms_logoplot @@ -5,9 +5,7 @@ Written by Jesse Bloom.""" -import sys import os -import re import time import math import natsort @@ -15,8 +13,7 @@ import pandas import phydmslib.weblogo import phydmslib.file_io import phydmslib.parsearguments -from phydmslib.constants import * - +from phydmslib.constants import AA_TO_INDEX def main(): @@ -37,9 +34,9 @@ def main(): # check on outfile we will create assert os.path.splitext(args['outfile'])[1].lower() == '.pdf', ( "outfile {0} does not end in '.pdf'".format(args['outfile'])) - assert (not os.path.dirname(args['outfile'])) or (os.path.isdir( - os.path.dirname(args['outfile']))), ("outfile {0} includes " - "non-existent directory".format(args['outfile'])) + assert (not os.path.dirname(args['outfile'])) or\ + (os.path.isdir(os.path.dirname(args['outfile']))),\ + ("outfile {0} includes non-existent directory".format(args['outfile'])) if os.path.isfile(args['outfile']): print("Removing existing outfile of {0}\n".format(args['outfile'])) os.remove(args['outfile']) @@ -49,8 +46,8 @@ def main(): if args['prefs']: datatype = 'prefs' print("Reading preferences from {0}".format(args['prefs'])) - prefs = phydmslib.file_io.readPrefs(args['prefs'], - sites_as_strings=True) + prefs = phydmslib.file_io.readPrefs(args['prefs'], + sites_as_strings=True) sites = natsort.realsorted(prefs.keys()) print("Read preferences for {0} sites.".format(len(sites))) beta = args['stringency'] @@ -61,16 +58,16 @@ def main(): prefsum = sum([prefs[r][a] for a in aas]) prefs[r] = dict([(a, prefs[r][a] / prefsum) for a in aas]) data = prefs - ydatamax = None + ydatamax = None elif args['diffprefs']: datatype = 'diffprefs' print("Reading differential preferences from {0}".format( args['diffprefs'])) - diffprefs = pandas.read_csv(args['diffprefs'], sep='\t', - comment='#') + diffprefs = pandas.read_csv(args['diffprefs'], sep='\t', comment='#') sites = natsort.realsorted(map(str, diffprefs['site'].values)) - print("Read differential preferences for {0} sites.".format(len(sites))) + print("Read differential preferences for {0} sites." + .format(len(sites))) data = {} ydatamax = args['diffprefheight'] * 1.01 for r in sites: @@ -82,8 +79,8 @@ def main(): sumneg = sum([-dpi for dpi in data[r].values() if dpi < 0]) if max(sumpos, sumneg) >= ydatamax: raise ValueError("diffprefs extend beyond --diffprefheight " - "{0}. Increase --diffprefheight.".format( - args['diffprefheight'])) + "{0}. Increase --diffprefheight." + .format(args['diffprefheight'])) else: raise ValueError("Didn't specify either --prefs or --diffprefs") @@ -94,15 +91,14 @@ def main(): fix_limits = {} if args['omegabysite']: print("\nWe will make an overlay with the site-specific omega " - "values in {0}.".format(args['omegabysite'])) - omegas = pandas.read_csv(args['omegabysite'], comment='#', - sep='\t') - assert set(sites) == set(map(str, omegas['site'].values)), ("sites " - "in {0} don't match those in prefs or diffprefs".format( - args['omegabysite'])) - shortname = '$\omega_r$' + "values in {0}.".format(args['omegabysite'])) + omegas = pandas.read_csv(args['omegabysite'], comment='#', sep='\t') + assert set(sites) == set(map(str, omegas['site'].values)),\ + ("sites in {0} don't match those in prefs or diffprefs" + .format(args['omegabysite'])) + shortname = r"$\omega_r$" longname = ('{0} $<1 \; \longleftarrow$ $\log_{{10}} P$ ' - '$\longrightarrow \;$ {0} $>1$'.format(shortname)) + '$\longrightarrow \;$ {0} $>1$'.format(shortname)) prop_d = {} for r in sites: omegar = float(omegas[omegas['site'].astype(str) == r]['omega']) @@ -112,8 +108,8 @@ def main(): else: prop_d[r] = -max(math.log10(args['minP']), math.log10(p)) overlay = [(prop_d, shortname, longname)] - ticklocs = [itick for itick in range(int(math.log10(args['minP'])), - 1 - int(math.log10(args['minP'])))] + ticklocs = [itick for itick in range(int(math.log10(args['minP'])), + 1 - int(math.log10(args['minP'])))] ticknames = [-abs(itick) for itick in ticklocs] fix_limits[shortname] = (ticklocs, ticknames) else: @@ -137,11 +133,11 @@ def main(): custom_cmap=args['colormap'], map_metric=args['mapmetric'], ) - assert os.path.isfile(args['outfile']), "Failed to create plot" + assert os.path.isfile(args['outfile']), "Failed to create plot" print("Created plot {0}".format(args['outfile'])) print('\nSuccessful completion of %s' % prog) if __name__ == '__main__': - main() # run the script + main() # run the script diff --git a/scripts/phydms_prepalignment b/scripts/phydms_prepalignment index bfbd6c5f..8b2bece3 100644 --- a/scripts/phydms_prepalignment +++ b/scripts/phydms_prepalignment @@ -10,18 +10,20 @@ import re import time import subprocess import matplotlib -matplotlib.use('pdf') import matplotlib.pyplot as plt -plt.style.use('ggplot') import Bio.SeqIO import Bio.Data.CodonTable import phydmslib.parsearguments import phydmslib.file_io +matplotlib.use('pdf') +plt.style.use('ggplot') + + +_cleanheader = re.compile(r'[\s\:\;\(\)\[\]\,\'\"]') -_cleanheader = re.compile('[\s\:\;\(\)\[\]\,\'\"]') def CleanHeader(head): - """Returns copy of header with problem characters replaced by underscore.""" + """Returns copy of header with problem characters replaced by '_'.""" return _cleanheader.sub('_', head) @@ -40,25 +42,29 @@ def MAFFT_CDSandProtAlignments(headseqprots, mafftcmd, tempfileprefix): The sequence order is preserved in this list. """ # mafft shortens sequence names to the first 253 characters - headseqprots = [(head[:254], seq, prot) for (head, seq, prot) in headseqprots] + headseqprots = [(head[:254], seq, prot) for + (head, seq, prot) in headseqprots] headseqprotsnames = [head for head, seq, prot in headseqprots] - assert len(headseqprotsnames) == len(set(headseqprotsnames)), "The first 253 characters of each sequence name must be unique." + assert len(headseqprotsnames) == len(set(headseqprotsnames)),\ + ("The first 253 characters of each sequence name must be unique.") seq_d = dict([(head, seq) for (head, seq, prot) in headseqprots]) prot_d = dict([(head, prot) for (head, seq, prot) in headseqprots]) - (tempfiledir, tempfilebase) = (os.path.dirname(tempfileprefix), os.path.basename(tempfileprefix)) + (tempfiledir, tempfilebase) = (os.path.dirname(tempfileprefix), + os.path.basename(tempfileprefix)) if tempfiledir: tempfileprefix = tempfiledir + '/_' + tempfilebase else: tempfileprefix = tempfilebase unalignedprotsfile = tempfileprefix + '_unaligned_mafft_prots.fasta' alignedprotsfile = tempfileprefix + '_aligned_mafft_prots.fasta' - outputfile = tempfileprefix + '_mafft_output.txt' + outfile = tempfileprefix + '_mafft_output.txt' with open(unalignedprotsfile, 'w') as f: - f.write('\n'.join(['>{0}\n{1}'.format(head, prot) for (head, seq, prot) in headseqprots])) + f.write('\n'.join(['>{0}\n{1}'.format(head, prot) for + (head, seq, prot) in headseqprots])) - with open(alignedprotsfile,'w') as stdout, open(outputfile, 'w') as stderr: + with open(alignedprotsfile, 'w') as stdout, open(outfile, 'w') as stderr: subprocess.check_call( [mafftcmd, '--auto', '--thread', '-1', unalignedprotsfile], stdout=stdout, @@ -71,18 +77,19 @@ def MAFFT_CDSandProtAlignments(headseqprots, mafftcmd, tempfileprefix): alignedprot = str(alignedprotrecord.seq) prot = prot_d[head] seq = seq_d[head] - assert ('-' not in prot) and ('-' not in seq), "Already gaps in seq or prot" + assert ('-' not in prot) and ('-' not in seq),\ + "Already gaps in seq or prot" assert len(alignedprot) >= len(prot) assert len(alignedprot.replace('-', '')) == len(prot) assert len(seq) == len(prot) * 3 alignedseq = [] - i = 0 # keeps track of position in unaligned prot + i = 0 # keeps track of position in unaligned prot for aa in alignedprot: if aa == '-': alignedseq.append('---') else: assert aa == prot[i] - alignedseq.append(seq[3 * i : 3 * i + 3]) + alignedseq.append(seq[3 * i:3 * i + 3]) i += 1 alignedseqprots_by_head[head] = (''.join(alignedseq), alignedprot) @@ -92,7 +99,7 @@ def MAFFT_CDSandProtAlignments(headseqprots, mafftcmd, tempfileprefix): (alignedseq, alignedprot) = alignedseqprots_by_head[head] alignedheadseqprots.append((head, alignedseq, alignedprot)) - for f in [unalignedprotsfile, alignedprotsfile, outputfile]: + for f in [unalignedprotsfile, alignedprotsfile, outfile]: os.remove(f) return alignedheadseqprots @@ -107,9 +114,11 @@ def main(): prog = parser.prog # print some basic information - print('\nBeginning execution of %s in directory %s at time %s\n' % (prog, os.getcwd(), time.asctime())) + print('\nBeginning execution of %s in directory %s at time %s\n' + % (prog, os.getcwd(), time.asctime())) print("%s\n" % phydmslib.file_io.Versions()) - print('Parsed the following command-line arguments:\n%s\n' % '\n'.join(['\t%s = %s' % tup for tup in args.items()])) + print('Parsed the following command-line arguments:\n%s\n' + % '\n'.join(['\t%s = %s' % tup for tup in args.items()])) plot = os.path.splitext(args['alignment'])[0] + '.pdf' for f in [plot, args['alignment']]: @@ -121,13 +130,18 @@ def main(): for argname in ['keepseqs', 'purgeseqs']: argvalue = args[argname] if argvalue: - if len(argvalue) == 1 and argvalue[0] and os.path.isfile(argvalue[0]): + if len(argvalue) == 1 and argvalue[0] and\ + os.path.isfile(argvalue[0]): with open(argvalue[0]) as f: - args[argname] = set([line.strip() for line in f.readlines() if line and not line.isspace()]) - print("Read {0} sequences from the --{1} file {2}".format(len(args[argname]), argname, argvalue[0])) + args[argname] = set([line.strip() for line in + f.readlines() if line and not + line.isspace()]) + print("Read {0} sequences from the --{1} file {2}" + .format(len(args[argname]), argname, argvalue[0])) else: args[argname] = set([x for x in argvalue if x]) - print("There are {0} sequences specified by --{1}".format(len(args[argname]), argname)) + print("There are {0} sequences specified by --{1}" + .format(len(args[argname]), argname)) else: args[argname] = set([]) @@ -147,12 +161,15 @@ def main(): if (purgename in head) or (purgename in cleanhead): for keepname in args['keepseqs']: if (keepname in head) or (keepname in cleanhead): - raise ValueError("--purgseqs and --keepseqs conflict about what to do with {0}".format(head)) + raise ValueError("--purgseqs and --keepseqs conflict " + "about what to do with {0}" + .format(head)) break else: cleanseqs.append(seq) seqs = cleanseqs - print("Retained {0} after removing those specified for purging by '--purgeseqs.'".format(len(seqs))) + print("Retained {0} after removing those specified for purging by " + "'--purgeseqs.'".format(len(seqs))) # remove gaps if sequences not pre-aligned if not args['prealigned']: @@ -161,12 +178,14 @@ def main(): # check length divisible by 3 seqs = [seq for seq in seqs if len(seq) % 3 == 0] - print("Retained {0} sequences after removing any with length not multiple of 3.".format(len(seqs))) + print("Retained {0} sequences after removing any with length not multiple " + "of 3.".format(len(seqs))) # purge ambiguous nucleotide sequences seqmatch = re.compile('^[ACTG-]+$') seqs = [seq for seq in seqs if seqmatch.search(str(seq.seq))] - print("Retained {0} sequences after purging any with ambiguous nucleotides.".format(len(seqs))) + print("Retained {0} sequences after purging any with ambiguous " + "nucleotides.".format(len(seqs))) # make sure all sequences translate without premature stops prots = [] @@ -175,7 +194,7 @@ def main(): try: prots.append(str(seqs[i].seq.translate(gap='-', stop_symbol='*'))) except Bio.Data.CodonTable.TranslationError: - remove_indices.append(i) # doesn't translate + remove_indices.append(i) # doesn't translate for i in sorted(remove_indices, reverse=True): del seqs[i] assert len(prots) == len(seqs) @@ -184,14 +203,14 @@ def main(): for i in range(len(seqs)): prot = prots[i] if (prot.count('*') == 1) and prot.replace('-', '')[-1] == '*': - # convert terminal stop to gap, trimmed later if all sites gapped + # convert terminal stop to gap, trimmed later if all gapped istop = prot.index('*') prot = list(prots[i]) prot[istop] = '-' prots[i] = ''.join(prot) # introduce gap requires making seq mutable iseq = seqs[i].seq.tomutable() - iseq[3 * istop : 3 * istop + 3] = '---' + iseq[3 * istop: 3 * istop + 3] = '---' seqs[i].seq = iseq.toseq() elif prot.count('*') >= 1: # premature stop @@ -201,31 +220,39 @@ def main(): prot = prots[i] if prot.count('*') == 1 and prot[-1] == '*': # trim terminal stop - prots[i] = prots[i][ : -1] - seqs[i].seq = seqs[i].seq[ : -3] + prots[i] = prots[i][:-1] + seqs[i].seq = seqs[i].seq[:-3] elif prot.count('*') >= 1: # premature stop remove_indices.append(i) for i in sorted(remove_indices, reverse=True): del prots[i] del seqs[i] - print("Retained {0} sequences after purging any with premature stops or that are otherwise un-translateable.".format(len(seqs))) + print("Retained {0} sequences after purging any with premature stops or " + "that are otherwise un-translateable.".format(len(seqs))) # get reference sequence - refseq = [seq for seq in seqs if (args['refseq'] in seq.description) or (CleanHeader(args['refseq']) in seq.description)] + refseq = [seq for seq in seqs if (args['refseq'] in seq.description) or + (CleanHeader(args['refseq']) in seq.description)] if len(refseq) == 1: refseq = refseq[0] - print("Using the following as reference sequence: {0}".format(refseq.description)) + print("Using the following as reference sequence: {0}" + .format(refseq.description)) elif len(refseq) < 1: - raise ValueError("Failed to find any sequence with a header that contained refseq identifier of {0}\nWas reference sequence purged due to not being translate-able?".format(args['refseq'])) + raise ValueError("Failed to find any sequence with a header that " + "contained refseq identifier of {0}\nWas reference " + "sequence purged due to not being translate-able?" + .format(args['refseq'])) else: - raise ValueError("Found multiple sequences with headers that contained refseq identifier of {0}".format(args['refseqs'])) + raise ValueError("Found multiple sequences with headers that " + "contained refseq identifier of {0}" + .format(args['refseqs'])) # For removing sequences, we make two lists: sequences to always keeps, # then other sequences ordered by frequency that protein occurs. # This allows us to preferentially retain common sequences. - seqs_alwayskeep = [] # entries are (head, seq, prot) as strings - protcounts = {} # keyed by protein, values are lists of (head, seq, prot) + seqs_alwayskeep = [] # entries are (head, seq, prot) as strings + protcounts = {} # keyed by protein, values are lists of (head, seq, prot) foundrefseq = False assert len(seqs) == len(prots) for (seqrecord, prot) in zip(seqs, prots): @@ -246,59 +273,88 @@ def main(): protcounts[prot].append((cleanhead, seq, prot)) else: protcounts[prot] = [(cleanhead, seq, prot)] - assert len(seqs) == len(seqs_alwayskeep) + sum([len(x) for x in protcounts.values()]), "Somehow lost sequences when looking for unique seqs." + assert len(seqs) == (len(seqs_alwayskeep) + + sum([len(x) for x in protcounts.values()])),\ + "Somehow lost sequences when looking for unique seqs." assert foundrefseq, "Never found refseq to add to seqs_alwayskeep" # get one unique copy of each protein sorted by number of copies - seqs_unique = sorted([(len(x), x[0]) for x in protcounts.values()], reverse=True) + seqs_unique = sorted([(len(x), x[0]) for x in protcounts.values()], + reverse=True) seqs_unique = [seqtup for (count, seqtup) in seqs_unique] - print("Purged sequences encoding redundant proteins, being sure to retain reference sequence and any specified by '--keepseqs'. Overall, {0} sequences remain.".format(len(seqs_unique) + len(seqs_alwayskeep))) - heads = [tup[0] for tup in seqs_unique] + [tup[0] for tup in seqs_alwayskeep] - assert len(heads) == len(set(heads)), "Found sequences with non-unique cleaned headers:\n%s".format('\n'.join([head for head in heads if heads.count(head) > 1])) + print("Purged sequences encoding redundant proteins, being sure to retain " + "reference sequence and any specified by '--keepseqs'. Overall, {0} " + "sequences remain.".format(len(seqs_unique) + len(seqs_alwayskeep))) + heads = [tup[0] for tup in seqs_unique] + [tup[0] + for tup in seqs_alwayskeep] + assert len(heads) == len(set(heads)),\ + ("Found sequences with non-unique cleaned headers:\n{0}" + .format('\n'.join([head for head in heads if heads.count(head) > 1]))) if args['prealigned']: - print("You specified '--prealigned', so the sequences are NOT being aligned.") + print("You specified '--prealigned', so the sequences are NOT being " + "aligned.") # make sure sequences all the same length seqlengths = [len(tup[1]) for tup in seqs_unique + seqs_alwayskeep] - assert all([seqlengths[0] == n for n in seqlengths]), "You indicated sequences are pre-aligned with the '--prealigned option, but they are not all of the same length." + assert all([seqlengths[0] == n for n in seqlengths]),\ + ("You indicated sequences are pre-aligned with the '--prealigned " + "option, but they are not all of the same length.") else: # align all sequences try: - mafftversion = subprocess.check_output([args['mafft'], '--version'], stderr=subprocess.STDOUT).strip() - print("Aligning sequences with MAFFT using {0} {1}".format(args['mafft'], mafftversion)) + mafftversion = (subprocess.check_output([args['mafft'], + '--version'], + stderr=subprocess.STDOUT) + .strip()) + print("Aligning sequences with MAFFT using {0} {1}" + .format(args['mafft'], mafftversion)) except OSError: - raise ValueError("The mafft command of {0} is not valid. Is mafft installed at this path?".format(args['mafft'])) - alignment = MAFFT_CDSandProtAlignments(seqs_unique + seqs_alwayskeep, args['mafft'], args['alignment']) - seqs_unique = alignment[ : len(seqs_unique)] - seqs_alwayskeep = alignment[len(seqs_unique) : ] + raise ValueError("The mafft command of {0} is not valid. Is mafft " + "installed at this path?".format(args['mafft'])) + alignment = MAFFT_CDSandProtAlignments(seqs_unique + seqs_alwayskeep, + args['mafft'], + args['alignment']) + seqs_unique = alignment[:len(seqs_unique)] + seqs_alwayskeep = alignment[len(seqs_unique):] seqlengths = [len(tup[1]) for tup in seqs_unique + seqs_alwayskeep] - assert all([seqlengths[0] == n for n in seqlengths]), "MAFFT alignment failed to yield sequences all of the same length." + assert all([seqlengths[0] == n for n in seqlengths]),\ + ("MAFFT alignment failed to yield sequences all of the same " + "length.") # strip gaps relative refseq - assert seqs_alwayskeep[0][0] == CleanHeader(refseq.description), "Expected refseq to have this header:\t{0}\nFound this:\t{1}".format(refseq.description, seqs_alwayskeep[0][0]) + assert seqs_alwayskeep[0][0] == CleanHeader(refseq.description),\ + ("Expected refseq to have this header:\t{0}\nFound this:\t{1}" + .format(refseq.description, seqs_alwayskeep[0][0])) refseqprot = seqs_alwayskeep[0][2] gapped = set([i for i in range(len(refseqprot)) if refseqprot[i] == '-']) for xlist in [seqs_alwayskeep, seqs_unique]: for (i, (head, seq, prot)) in enumerate(xlist): - strippedprot = ''.join([aa for (j, aa) in enumerate(prot) if j not in gapped]) - strippedseq = ''.join([seq[3 * j : 3 * j + 3] for j in range(len(prot)) if j not in gapped]) + strippedprot = ''.join([aa for (j, aa) in enumerate(prot) + if j not in gapped]) + strippedseq = ''.join([seq[3 * j: 3 * j + 3] for j in + range(len(prot)) if j not in gapped]) xlist[i] = (head, strippedseq, strippedprot) - refseqprot = seqs_alwayskeep[0][2] # with gaps removed - assert '-' not in refseqprot, "Gap stripping from reference sequence failed." - refseq = seqs_alwayskeep[0][1] # with gaps removed + refseqprot = seqs_alwayskeep[0][2] # with gaps removed + assert '-' not in refseqprot, ("Gap stripping from reference sequence " + "failed.") + refseq = seqs_alwayskeep[0][1] # with gaps removed assert '-' not in refseq, "Gap stripping from reference sequence failed." - print("After stripping gaps relative to reference sequence, all proteins are of length {0}".format(len(refseqprot))) + print("After stripping gaps relative to reference sequence, all proteins " + "are of length {0}".format(len(refseqprot))) - # make seqs_unique, seq_alwayskeep be *(head, seq, prot, ntident, protident)* + # make seqs_unique, seq_alwayskeep be + # *(head, seq, prot, ntident, protident)* refseqprotlength = float(len(refseqprot)) refseqlength = float(len(refseq)) for xlist in [seqs_alwayskeep, seqs_unique]: for (i, (head, seq, prot)) in enumerate(xlist): - protident = sum([x == y for (x, y) in zip(prot, refseqprot)]) / refseqprotlength - ntident = sum([x == y for (x, y) in zip(seq, refseq)]) / refseqlength + protident = (sum([x == y for (x, y) in zip(prot, refseqprot)]) / + refseqprotlength) + ntident = (sum([x == y for (x, y) in zip(seq, refseq)]) / + refseqlength) xlist[i] = (head, seq, prot, ntident, protident) # purge sequences that don't meet identity threshold - purged_idents = [] # list of *(ntident, protident)* for purged sequences + purged_idents = [] # list of *(ntident, protident)* for purged sequences for xlist in [seqs_unique]: remove_indices = [] for (i, (head, seq, prot, ntident, protident)) in enumerate(xlist): @@ -307,7 +363,9 @@ def main(): remove_indices.append(i) for i in sorted(remove_indices, reverse=True): del xlist[i] - print("Retained {0} sequences after purging those with < {1} protein identity to reference sequence.".format(len(seqs_alwayskeep + seqs_unique), args['minidentity'])) + print("Retained {0} sequences after purging those with < {1} protein " + "identity to reference sequence." + .format(len(seqs_alwayskeep + seqs_unique), args['minidentity'])) # purge sequences that don't meet uniqueness threshold alignment = seqs_alwayskeep @@ -319,16 +377,20 @@ def main(): break else: alignment.append((head, seq, prot, ntident, protident)) - print("Retained {0} sequences after purging those without at least {1} amino-acid differences with other retained sequences.".format(len(alignment), args['minuniqueness'])) + print("Retained {0} sequences after purging those without at least {1} " + "amino-acid differences with other retained sequences." + .format(len(alignment), args['minuniqueness'])) # write final alignment of coding sequences - print("Writing the final alignment of {0} coding sequences to {1}".format(len(alignment), args['alignment'])) + print("Writing the final alignment of {0} coding sequences to {1}" + .format(len(alignment), args['alignment'])) with open(args['alignment'], 'w') as f: for (head, seq, prot, ntident, protident) in alignment: f.write('>{0}\n{1}\n'.format(head, seq)) # make plot - retained_idents = [(ntident, protident) for (head, seq, prot, ntident, protident) in alignment] + retained_idents = [(ntident, protident) for + (head, seq, prot, ntident, protident) in alignment] print("Plotting retained and purged sequences to {0}".format(plot)) fig = plt.figure() points = [] @@ -356,4 +418,4 @@ def main(): if __name__ == '__main__': - main() # run the script + main() # run the script diff --git a/setup.py b/setup.py index 1226c82d..a4eb1257 100644 --- a/setup.py +++ b/setup.py @@ -13,8 +13,8 @@ except ImportError: raise ImportError("You must install setuptools") -if not (sys.version_info[0] == 3 and sys.version_info[1] >= 5): - raise RuntimeError('phydms requires Python 3.5 or higher.\n' +if not (sys.version_info[0] == 3 and sys.version_info[1] >= 6): + raise RuntimeError('phydms requires Python 3.6 or higher.\n' 'You are using Python {0}.{1}'.format( sys.version_info[0], sys.version_info[1])) @@ -63,7 +63,7 @@ def extensions(): Extension('phydmslib.numutils', ['phydmslib/numutils.pyx'], include_dirs=[numpy.get_include()], extra_compile_args=['-Wno-unused-function']), - ] + ] return cythonize(ext) # main setup command diff --git a/tests/NP_data/NP_prefs_5.csv b/tests/NP_data/NP_prefs_5.csv new file mode 100644 index 00000000..3477b154 --- /dev/null +++ b/tests/NP_data/NP_prefs_5.csv @@ -0,0 +1,6 @@ +site,A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y +1,0.0448959,0.0461868,0.0487332,0.0461879,0.0467506,0.0411084,0.0529134,0.0270247,0.046272,0.0439419,0.172267,0.0453542,0.0454932,0.0452166,0.0447873,0.0414766,0.0379993,0.0282543,0.0464337,0.0487029 +2,0.658251,0.00668612,0.0052911,0.0296401,0.00564699,0.019848,0.00767229,0.00414258,0.00780895,0.00182799,0.0367587,0.00517087,0.00934743,0.00390342,0.00596331,0.0144603,0.0138282,0.148105,0.00982134,0.00582609 +3,0.0780122,0.0165141,0.00485352,0.00418567,0.155017,0.0310392,0.104461,0.0239216,0.0102993,0.107051,0.0248013,0.0594595,0.0169042,0.0205734,0.0206575,0.124961,0.101368,0.0123348,0.0251918,0.0583932 +4,0.0283045,0.0163793,0.00332903,0.0260252,0.213487,0.00637175,0.0211979,0.0516822,0.0202307,0.0671016,0.038247,0.0780188,0.0658722,0.0571062,0.00705902,0.136913,0.0368145,0.026051,0.0238845,0.0759249 +5,0.0723228,0.0979086,0.0142496,0.00682441,0.034014,0.319673,0.0160518,0.00498863,0.00882372,0.00867121,0.0104252,0.051271,0.0309662,0.00658103,0.146711,0.0809347,0.0358269,0.0106112,0.0258496,0.0172943 diff --git a/tests/NP_data/NP_prefs_shorter.csv b/tests/NP_data/NP_prefs_shorter.csv new file mode 100644 index 00000000..a639c808 --- /dev/null +++ b/tests/NP_data/NP_prefs_shorter.csv @@ -0,0 +1,50 @@ +site,A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y +1,0.0448959,0.0461868,0.0487332,0.0461879,0.0467506,0.0411084,0.0529134,0.0270247,0.046272,0.0439419,0.172267,0.0453542,0.0454932,0.0452166,0.0447873,0.0414766,0.0379993,0.0282543,0.0464337,0.0487029 +2,0.658251,0.00668612,0.0052911,0.0296401,0.00564699,0.019848,0.00767229,0.00414258,0.00780895,0.00182799,0.0367587,0.00517087,0.00934743,0.00390342,0.00596331,0.0144603,0.0138282,0.148105,0.00982134,0.00582609 +3,0.0780122,0.0165141,0.00485352,0.00418567,0.155017,0.0310392,0.104461,0.0239216,0.0102993,0.107051,0.0248013,0.0594595,0.0169042,0.0205734,0.0206575,0.124961,0.101368,0.0123348,0.0251918,0.0583932 +4,0.0283045,0.0163793,0.00332903,0.0260252,0.213487,0.00637175,0.0211979,0.0516822,0.0202307,0.0671016,0.038247,0.0780188,0.0658722,0.0571062,0.00705902,0.136913,0.0368145,0.026051,0.0238845,0.0759249 +5,0.0723228,0.0979086,0.0142496,0.00682441,0.034014,0.319673,0.0160518,0.00498863,0.00882372,0.00867121,0.0104252,0.051271,0.0309662,0.00658103,0.146711,0.0809347,0.0358269,0.0106112,0.0258496,0.0172943 +6,0.0401887,0.0116331,0.00496686,0.00547105,0.00507353,0.00286099,0.00814937,0.0245401,0.00573008,0.0624501,0.0172157,0.0243727,0.00634967,0.0101887,0.00530073,0.0137468,0.72826,0.00287984,0.0144726,0.00614978 +7,0.0030798,0.00781716,0.00663753,0.036367,0.00646089,0.00272922,0.00531263,0.0180689,0.776139,0.00242119,0.00955715,0.0484728,0.00214969,0.019417,0.0144803,0.00235899,0.00994966,0.00759042,0.0115169,0.00947408 +8,0.00528452,0.0136153,0.00631543,0.00628495,0.00795126,0.0184269,0.00467245,0.00400241,0.00508044,0.0270425,0.0119939,0.0064684,0.028,0.0519721,0.755856,0.00416846,0.0071853,0.00504122,0.0254168,0.00522253 +9,0.163255,0.0171213,0.00271813,0.00791336,0.0323953,0.0192058,0.0913362,0.0340963,0.00621512,0.0825761,0.0439206,0.0790065,0.0639257,0.0638017,0.00447865,0.204871,0.0283948,0.023639,0.0105016,0.0206282 +10,0.0571892,0.0422296,0.0243782,0.0143506,0.0590255,0.0089711,0.21659,0.0643998,0.0277853,0.048936,0.0139819,0.0371775,0.0464459,0.0187166,0.00347213,0.0229364,0.0173634,0.0471515,0.00803017,0.220869 +11,0.0226683,0.0225533,0.0585967,0.43724,0.0191579,0.0411278,0.0230995,0.028961,0.0396672,0.00952798,0.032188,0.0165959,0.00702311,0.0431257,0.013521,0.0279003,0.0399507,0.0358849,0.0657319,0.0154781 +12,0.0336397,0.024637,0.0658258,0.0100686,0.0261948,0.00832485,0.163176,0.0462303,0.111994,0.0360989,0.0301587,0.0489951,0.0148819,0.11721,0.0689272,0.120153,0.0287786,0.0146745,0.0125096,0.0175228 +13,0.0148647,0.0187466,0.0442126,0.0191295,0.0109921,0.0146757,0.0065979,0.0317928,0.040216,0.0155451,0.514027,0.0125394,0.00579527,0.0366092,0.0187595,0.0069302,0.116625,0.0199407,0.0293599,0.0226406 +14,0.0131117,0.0223144,0.13596,0.408273,0.0304737,0.0215357,0.00822106,0.0115054,0.0594038,0.0446622,0.0145347,0.0201586,0.00436936,0.0203546,0.116798,0.016092,0.0165091,0.0175781,0.0113155,0.00682944 +15,0.0136265,0.275414,0.00485029,0.0236967,0.0151088,0.0033632,0.0764768,0.0609477,0.00679895,0.0751282,0.0796918,0.0338946,0.0105117,0.0125091,0.00451393,0.0181098,0.242948,0.0273086,0.0077351,0.00736746 +16,0.0141538,0.0259708,0.456742,0.111193,0.0114181,0.0607094,0.0243268,0.0129386,0.0067572,0.00541535,0.0270246,0.033392,0.00396773,0.0424096,0.0201793,0.011521,0.0368596,0.0213599,0.0439802,0.0296813 +17,0.0601791,0.0695343,0.00592071,0.0155594,0.0032758,0.262196,0.011039,0.0152008,0.0346407,0.0140722,0.0409719,0.0541914,0.104094,0.0542646,0.1464,0.0299644,0.0290723,0.0385162,0.00823044,0.00267771 +18,0.0817815,0.0333402,0.0890235,0.20119,0.0214276,0.0232721,0.0298276,0.0765493,0.0144658,0.0358575,0.0122306,0.0253231,0.0672586,0.0651938,0.00661333,0.0275628,0.0431078,0.100218,0.0180484,0.0277065 +19,0.0113599,0.0319659,0.0126611,0.00933319,0.0408417,0.0267247,0.0845619,0.00593767,0.0365777,0.0201705,0.0173995,0.0200936,0.0341374,0.0137302,0.503901,0.0435128,0.015709,0.043783,0.0156722,0.0119268 +20,0.0138235,0.0395755,0.00569742,0.0252321,0.0238796,0.00703126,0.0215151,0.00608292,0.0206124,0.0292555,0.0138191,0.0123599,0.165761,0.44856,0.036535,0.0599168,0.0166194,0.0258871,0.0088473,0.0189883 +21,0.0118919,0.0578009,0.0285086,0.0299036,0.0358029,0.0415233,0.0342431,0.0331661,0.0631,0.0329061,0.0505077,0.166885,0.0205519,0.0218595,0.0348471,0.179422,0.0788154,0.0127836,0.0491899,0.0162911 +22,0.158806,0.00612984,0.0197751,0.0126822,0.0120511,0.144576,0.0328048,0.0322925,0.0563339,0.0167088,0.0220174,0.0273489,0.0251933,0.0170516,0.126898,0.0861482,0.0616915,0.103209,0.0283493,0.00993191 +23,0.0518376,0.0200853,0.00659799,0.00660837,0.0513897,0.0379616,0.0993998,0.0262472,0.0115024,0.0476302,0.0359857,0.04495,0.0317672,0.0881037,0.0416278,0.105302,0.16068,0.0453713,0.0387763,0.0481757 +24,0.0236995,0.0177059,0.0467448,0.193684,0.0604032,0.00811863,0.0166719,0.0620206,0.0235102,0.168198,0.0338201,0.017574,0.00794697,0.0982881,0.0239337,0.0139251,0.0743813,0.0413742,0.0538992,0.0141015 +25,0.040725,0.0220007,0.123104,0.0467914,0.00769441,0.0423143,0.0128013,0.102351,0.0101223,0.0580914,0.0368248,0.123857,0.121138,0.0471196,0.0234842,0.028936,0.079378,0.0446937,0.00727917,0.0212943 +26,0.170587,0.00754386,0.0073288,0.0193139,0.0348526,0.0188248,0.0732251,0.0709699,0.103092,0.0409574,0.0375547,0.0188392,0.0119203,0.0484918,0.079945,0.0277515,0.0489449,0.0655048,0.0204687,0.0938838 +27,0.0402851,0.071221,0.00431947,0.0225723,0.0245041,0.0799343,0.0300985,0.00528844,0.0555436,0.0365333,0.0405877,0.14888,0.0109784,0.101701,0.0370142,0.200509,0.0196817,0.00966834,0.0075148,0.0531658 +28,0.0362448,0.0835686,0.0380563,0.0128492,0.0334435,0.0129962,0.00940845,0.178007,0.0124108,0.025418,0.0316457,0.0128785,0.0307165,0.0161751,0.0147937,0.0166445,0.0139218,0.392617,0.0181396,0.0100643 +29,0.0517735,0.0232752,0.0149853,0.0344375,0.0286744,0.427369,0.0102681,0.0291098,0.0229237,0.00686669,0.0269237,0.117933,0.0141049,0.0660299,0.0212934,0.026551,0.0170806,0.0267326,0.0215964,0.0120717 +30,0.0862694,0.028997,0.0127037,0.0489531,0.0284189,0.0335804,0.0684146,0.034849,0.236542,0.0223098,0.0793602,0.0329681,0.015623,0.0186658,0.135908,0.0197264,0.0355907,0.019904,0.0267552,0.0144607 +31,0.0152228,0.0159501,0.0125729,0.0146519,0.04885,0.0165664,0.0297641,0.0259477,0.0307736,0.0273269,0.49575,0.0668884,0.0185944,0.0135049,0.0146201,0.0412534,0.033037,0.0452588,0.0158257,0.0176408 +32,0.0619239,0.134839,0.0145775,0.016463,0.0291838,0.0325494,0.00810771,0.303406,0.0127186,0.0677241,0.0798586,0.0241414,0.0144204,0.00913532,0.00411965,0.0208843,0.0695282,0.067013,0.0147481,0.0146578 +33,0.13173,0.058732,0.0607421,0.0809862,0.0310642,0.121766,0.0672206,0.0560433,0.0324917,0.0609864,0.0410656,0.0362468,0.0075547,0.023963,0.0272007,0.0401449,0.0390853,0.0384713,0.0171981,0.0273069 +34,0.0434973,0.0294434,0.0163526,0.038281,0.0255521,0.396492,0.0382353,0.0206764,0.0246631,0.0175818,0.0222443,0.0462562,0.0106323,0.0322563,0.0305755,0.0661193,0.034098,0.0340077,0.049208,0.0238274 +35,0.032719,0.0262501,0.0486198,0.0267445,0.0658553,0.0170485,0.013365,0.316607,0.0215224,0.0746238,0.0971015,0.0305545,0.0132534,0.0218591,0.0137491,0.025827,0.0502255,0.0512535,0.038461,0.0143596 +36,0.0523207,0.0440935,0.0212963,0.0641478,0.0285525,0.369345,0.0362377,0.0323426,0.0282505,0.0245375,0.0301131,0.0220538,0.0163093,0.0212388,0.0352425,0.0524769,0.0165685,0.0493642,0.0375608,0.0179482 +37,0.0333096,0.0289483,0.0218136,0.0232528,0.0212844,0.0786746,0.0815889,0.049715,0.0213336,0.0430908,0.0843084,0.0186513,0.0193521,0.0414115,0.273666,0.0385716,0.0371462,0.0165725,0.0493922,0.0179175 +38,0.060609,0.105016,0.0129928,0.0119337,0.22661,0.0168112,0.00931881,0.0249691,0.0146355,0.0167839,0.0884415,0.0257453,0.018983,0.0125499,0.0102676,0.0208376,0.0277694,0.068289,0.185943,0.0414922 +39,0.0451232,0.0187534,0.030608,0.00801043,0.034713,0.00787122,0.244094,0.0125267,0.00613437,0.014805,0.054465,0.0246883,0.013221,0.0360334,0.0280499,0.0137471,0.0191184,0.0107856,0.039856,0.337396 +40,0.0370152,0.0330256,0.0268451,0.0223326,0.0254878,0.0473728,0.0071496,0.0919548,0.00672268,0.154437,0.046548,0.0429861,0.0184264,0.0362811,0.0266738,0.0886706,0.0799475,0.0291842,0.0659321,0.113008 +41,0.0194171,0.0214042,0.0331755,0.0313326,0.01454,0.0351093,0.037893,0.0241474,0.0486451,0.0195908,0.0304021,0.0137934,0.026577,0.473559,0.0272883,0.0165151,0.0586582,0.0220954,0.0186499,0.0272069 +42,0.0430622,0.0315547,0.0152214,0.031706,0.0640751,0.0143709,0.0227302,0.0477631,0.0478756,0.0487967,0.365147,0.106607,0.00797943,0.0123796,0.0165764,0.0139846,0.0350701,0.0410093,0.0134907,0.0205992 +43,0.0392853,0.19906,0.0105119,0.0486237,0.0257242,0.0495064,0.0143672,0.0762425,0.0710459,0.04904,0.0305778,0.0259037,0.00775218,0.0242381,0.0332573,0.0787076,0.0430784,0.0756506,0.0701237,0.0273031 +44,0.0285597,0.0424822,0.0240822,0.0328709,0.0198238,0.0128715,0.0221995,0.0364638,0.01766,0.046288,0.0433807,0.0385444,0.0251946,0.0155775,0.0215505,0.0675817,0.376161,0.0820755,0.0284946,0.0181385 +45,0.0182795,0.0273777,0.0421919,0.421475,0.0316414,0.0244083,0.0461362,0.0293491,0.0348785,0.0511728,0.0376131,0.0210499,0.0401572,0.0315763,0.0273689,0.0124355,0.0329079,0.0329402,0.0194751,0.0175661 +46,0.0164497,0.064989,0.0244124,0.0514188,0.0306626,0.0244593,0.0247993,0.137559,0.0155949,0.244878,0.0912016,0.0194573,0.0321702,0.0153221,0.0277143,0.0157662,0.0501064,0.0697695,0.019082,0.0241871 +47,0.0479761,0.0215908,0.031464,0.0153765,0.0170095,0.0964076,0.0270651,0.025898,0.244268,0.0356879,0.051589,0.0320988,0.042246,0.0610186,0.0456478,0.0709458,0.0709077,0.0403245,0.0132686,0.00920964 +48,0.0323314,0.028321,0.0170354,0.0156162,0.0767947,0.010579,0.0221089,0.0741056,0.0110339,0.361934,0.0637876,0.0150372,0.0241989,0.0187563,0.0192482,0.0126842,0.0323322,0.100802,0.0291528,0.0341403 +49,0.113351,0.0772528,0.0435425,0.0374249,0.0187275,0.180432,0.0340627,0.0383131,0.0247413,0.0191605,0.0315766,0.0187795,0.0413732,0.10512,0.0236208,0.100329,0.051855,0.0286402,0.00405379,0.0076439 diff --git a/tests/REL_input_data/NP_alignment.fasta b/tests/REL_input_data/NP_alignment.fasta new file mode 100644 index 00000000..7cb20e60 --- /dev/null +++ b/tests/REL_input_data/NP_alignment.fasta @@ -0,0 +1,10 @@ +>1988.16_748_A/Netherlands/450/1988_HOST_Human_H3N2 +ATGGCGTCCCAAGGCACCAAACGGTCTTAT +>2000.01_1_A/New_York/433/2000_HOST_Human_H3N2 +ATGGCGTCCCAAGGCACCAAACGGTCTTAT +>2004.59_17_A/Canterbury/12/2004_HOST_Human_H3N2 +ATGGCGTCCCAAGGCACCAAACGGTCTTAT +>2008.16_16_A/Boston/64/2008_HOST_Human_H3N2 +ATGGCGTCCCAAGGCACCAAACGGTCTTAT +>2012.07_122_A/California/17/2012_HOST_Human_H3N2 +ATGGCGTCCCAAGGCACCAAACGGTCTTAT diff --git a/tests/REL_input_data/NP_prefs.csv b/tests/REL_input_data/NP_prefs.csv new file mode 100644 index 00000000..6a3b8a18 --- /dev/null +++ b/tests/REL_input_data/NP_prefs.csv @@ -0,0 +1,11 @@ +site,A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y +1,0.0448959,0.04618680000000001,0.0487332,0.046187900000000004,0.046750599999999996,0.0411084,0.0529134,0.027024700000000002,0.046272,0.043941900000000006,0.172267,0.0453542,0.0454932,0.0452166,0.0447873,0.041476599999999995,0.03799930000000001,0.0282543,0.0464337,0.0487029 +2,0.658251,0.00668612,0.0052911,0.029640100000000003,0.00564699,0.019847999999999998,0.00767229,0.00414258,0.00780895,0.00182799,0.0367587,0.00517087,0.00934743,0.00390342,0.00596331,0.014460299999999999,0.0138282,0.148105,0.00982134,0.00582609 +3,0.07801219999999999,0.0165141,0.00485352,0.00418567,0.15501700000000002,0.0310392,0.10446099999999998,0.023921599999999998,0.010299299999999999,0.107051,0.024801300000000002,0.059459500000000005,0.0169042,0.020573400000000002,0.0206575,0.12496099999999999,0.101368,0.0123348,0.0251918,0.0583932 +4,0.028304500000000003,0.0163793,0.00332903,0.026025200000000002,0.21348699999999998,0.00637175,0.021197900000000002,0.0516822,0.0202307,0.06710160000000001,0.038247,0.0780188,0.06587219999999999,0.0571062,0.00705902,0.136913,0.0368145,0.026050999999999998,0.0238845,0.07592489999999999 +5,0.0723228,0.0979086,0.014249600000000001,0.00682441,0.034013999999999996,0.319673,0.0160518,0.00498863,0.00882372,0.00867121,0.0104252,0.051271000000000004,0.030966200000000003,0.00658103,0.14671099999999998,0.0809347,0.0358269,0.010611200000000001,0.025849599999999997,0.0172943 +6,0.040188699999999994,0.0116331,0.00496686,0.00547105,0.00507353,0.00286099,0.00814937,0.0245401,0.00573008,0.062450099999999995,0.0172157,0.0243727,0.00634967,0.0101887,0.00530073,0.013746799999999998,0.72826,0.00287984,0.0144726,0.00614978 +7,0.0030798,0.00781716,0.00663753,0.036367000000000003,0.00646089,0.00272922,0.00531263,0.018068900000000002,0.776139,0.00242119,0.00955715,0.0484728,0.00214969,0.019417,0.0144803,0.00235899,0.00994966,0.00759042,0.0115169,0.00947408 +8,0.00528452,0.013615299999999999,0.00631543,0.00628495,0.00795126,0.0184269,0.00467245,0.00400241,0.00508044,0.0270425,0.0119939,0.0064684,0.027999999999999997,0.0519721,0.7558560000000001,0.00416846,0.007185300000000001,0.00504122,0.0254168,0.00522253 +9,0.16325499999999998,0.0171213,0.00271813,0.00791336,0.032395299999999995,0.0192058,0.09133619999999999,0.0340963,0.00621512,0.08257610000000001,0.0439206,0.07900650000000001,0.06392569999999999,0.06380169999999999,0.00447865,0.204871,0.028394799999999998,0.023639,0.0105016,0.020628200000000003 +10,0.057189199999999996,0.0422296,0.024378200000000003,0.0143506,0.0590255,0.0089711,0.21659,0.06439980000000001,0.027785300000000002,0.048936,0.013981899999999998,0.037177499999999995,0.0464459,0.0187166,0.00347213,0.0229364,0.0173634,0.0471515,0.00803017,0.220869 diff --git a/tests/REL_input_data/NP_simulated_alignment.fasta b/tests/REL_input_data/NP_simulated_alignment.fasta new file mode 100644 index 00000000..bd8dfc6c --- /dev/null +++ b/tests/REL_input_data/NP_simulated_alignment.fasta @@ -0,0 +1,10 @@ +>1988.16_748_A/Netherlands/450/1988_HOST_Human_H3N2 +AGAGTATCCAGTGCGACGAAGCGTAGCAAG +>2004.59_17_A/Canterbury/12/2004_HOST_Human_H3N2 +AGGGTAAGCATTGCGACGAAGCGTAGCAAG +>2012.07_122_A/California/17/2012_HOST_Human_H3N2 +AGAGTATCCATTGCGACGAAGCGTAGCAAG +>2008.16_16_A/Boston/64/2008_HOST_Human_H3N2 +AGAGTAACCATTGCGACGAAGCGTAGCAAG +>2000.01_1_A/New_York/433/2000_HOST_Human_H3N2 +AGAGTATTCATTGCGACGAAGCGTAGCAAG diff --git a/tests/REL_input_data/NP_tree.newick b/tests/REL_input_data/NP_tree.newick new file mode 100644 index 00000000..c370e3aa --- /dev/null +++ b/tests/REL_input_data/NP_tree.newick @@ -0,0 +1 @@ +(1988.16_748_A/Netherlands/450/1988_HOST_Human_H3N2:0.00253721527309063669,((2004.59_17_A/Canterbury/12/2004_HOST_Human_H3N2:0.00521987676867473153,(2012.07_122_A/California/17/2012_HOST_Human_H3N2:0.01335410520967073023,2008.16_16_A/Boston/64/2008_HOST_Human_H3N2:0.00252712104706821761):0.00272350285348587750):0.01655101358864263447,2000.01_1_A/New_York/433/2000_HOST_Human_H3N2:0.00218356166973397627):0.00843184236384168957):0.00; diff --git a/tests/expected_NP_test_results/ExpCM_NP_prefs_short_diffprefsbysite.txt b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_diffprefsbysite.txt index b5a31bd9..32006022 100644 --- a/tests/expected_NP_test_results/ExpCM_NP_prefs_short_diffprefsbysite.txt +++ b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_diffprefsbysite.txt @@ -131,4 +131,4 @@ site dpi_A dpi_C dpi_D dpi_E dpi_F dpi_G dpi_H dpi_I dpi_K dpi_L dpi_M dpi_N dpi 8 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 6 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 14 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -113 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 \ No newline at end of file +113 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 diff --git a/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_loglikelihood.txt b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_loglikelihood.txt new file mode 100644 index 00000000..3266c16b --- /dev/null +++ b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_loglikelihood.txt @@ -0,0 +1 @@ +log likelihood = -774.63 \ No newline at end of file diff --git a/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_modelparams.txt b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_modelparams.txt new file mode 100644 index 00000000..aff98384 --- /dev/null +++ b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_modelparams.txt @@ -0,0 +1,7 @@ +alpha_omega = 1.65488 +beta = 3.38097 +beta_omega = 1.64608 +kappa = 8.8788 +phiA = 0.355403 +phiC = 0.201762 +phiG = 0.249384 \ No newline at end of file diff --git a/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_omegabycategory.csv b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_omegabycategory.csv new file mode 100644 index 00000000..6a206761 --- /dev/null +++ b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_omegabycategory.csv @@ -0,0 +1,261 @@ +site,omega,post_probability +1,0.43267167875709295,0.5034358037077438 +2,0.43267167875709295,0.4752156714188946 +3,0.43267167875709295,0.6154402199321217 +4,0.43267167875709295,0.4971796261450352 +5,0.43267167875709295,0.487023983619035 +6,0.43267167875709295,0.48303560727677985 +7,0.43267167875709295,0.4839734924081158 +8,0.43267167875709295,0.5487996049045677 +9,0.43267167875709295,0.4890647507954123 +10,0.43267167875709295,0.6703410424346747 +11,0.43267167875709295,0.4842844935212233 +12,0.43267167875709295,0.5128262384645004 +13,0.43267167875709295,0.5012374774464863 +14,0.43267167875709295,0.6332255455759669 +15,0.43267167875709295,0.4840313295790521 +16,0.43267167875709295,0.48779243575722964 +17,0.43267167875709295,0.5724513876809731 +18,0.43267167875709295,0.26959706185126003 +19,0.43267167875709295,0.48392567820618837 +20,0.43267167875709295,0.4775950789374921 +21,0.43267167875709295,0.5400235647824242 +22,0.43267167875709295,0.5872464012484004 +23,0.43267167875709295,0.49105798314225346 +24,0.43267167875709295,0.6333331077364841 +25,0.43267167875709295,0.562715783505033 +26,0.43267167875709295,0.5649549331802359 +27,0.43267167875709295,0.489477018214081 +28,0.43267167875709295,0.5609463714638434 +29,0.43267167875709295,0.571920253663045 +30,0.43267167875709295,0.5544549175406053 +31,0.43267167875709295,0.1658970894524385 +32,0.43267167875709295,0.5001713393857059 +33,0.43267167875709295,0.487199999932419 +34,0.43267167875709295,0.16651346355063423 +35,0.43267167875709295,0.4813387876474218 +36,0.43267167875709295,0.48591935150486365 +37,0.43267167875709295,0.6305625332100779 +38,0.43267167875709295,0.5566230983257656 +39,0.43267167875709295,0.48918083415884517 +40,0.43267167875709295,0.5072382088999616 +41,0.43267167875709295,0.5328095514619321 +42,0.43267167875709295,0.4840237025541102 +43,0.43267167875709295,0.5008714578091457 +44,0.43267167875709295,0.5672426485428027 +45,0.43267167875709295,0.6386541927838696 +46,0.43267167875709295,0.5606839028783961 +47,0.43267167875709295,0.6360288601312046 +48,0.43267167875709295,0.5621893008923758 +49,0.43267167875709295,0.5611082451138998 +50,0.43267167875709295,0.3928581113632713 +51,0.43267167875709295,0.5573256885594182 +52,0.43267167875709295,0.305564522157969 +53,0.43267167875709295,0.5557028686766794 +54,0.43267167875709295,0.5570022767059383 +55,0.43267167875709295,0.8098521915175816 +56,0.43267167875709295,0.6154005445288484 +57,0.43267167875709295,0.49409239308762914 +58,0.43267167875709295,0.5542810506687584 +59,0.43267167875709295,0.4876494158216771 +60,0.43267167875709295,0.48931160290197706 +61,0.43267167875709295,0.3182077551244162 +62,0.43267167875709295,0.483283508923628 +63,0.43267167875709295,0.4986322088333087 +64,0.43267167875709295,0.47718148654816117 +65,0.43267167875709295,0.36972251960676306 +66,0.43267167875709295,0.5030471781530861 +67,0.43267167875709295,0.5554072508439404 +68,0.43267167875709295,0.487985287026961 +69,0.43267167875709295,0.4826973843269547 +70,0.43267167875709295,0.4900019870348157 +71,0.43267167875709295,0.4886810284746438 +72,0.43267167875709295,0.6376607969813188 +73,0.43267167875709295,0.7040921099435692 +74,0.43267167875709295,0.5665828104624576 +75,0.43267167875709295,0.5536720832040816 +76,0.43267167875709295,0.2699789968987546 +77,0.43267167875709295,0.14216844588385003 +78,0.43267167875709295,0.639552808515138 +79,0.43267167875709295,0.46168371650246526 +80,0.43267167875709295,0.49540214717861614 +81,0.43267167875709295,0.4855193768218404 +82,0.43267167875709295,0.5844840046704632 +83,0.43267167875709295,0.48528902360076004 +84,0.43267167875709295,0.705107177149914 +85,0.43267167875709295,0.7117160915403951 +86,0.43267167875709295,0.4751585590101247 +87,0.43267167875709295,0.6366472026316986 +88,0.43267167875709295,0.60158431841056 +89,0.43267167875709295,0.5654099186896723 +90,0.43267167875709295,0.49888790107149156 +91,0.43267167875709295,0.4968658493463513 +92,0.43267167875709295,0.4826741718237055 +93,0.43267167875709295,0.5571138395746013 +94,0.43267167875709295,0.6301654899520048 +95,0.43267167875709295,0.5622318516162566 +96,0.43267167875709295,0.5046254419575206 +97,0.43267167875709295,0.49814826355222 +98,0.43267167875709295,0.15352840682274413 +99,0.43267167875709295,0.4852292057737122 +100,0.43267167875709295,0.3555863308038347 +101,0.43267167875709295,0.026854055217237688 +102,0.43267167875709295,0.45561592109994503 +103,0.43267167875709295,0.16587159755479547 +104,0.43267167875709295,0.5001087206981536 +105,0.43267167875709295,0.3226883312685087 +106,0.43267167875709295,0.5701733728966195 +107,0.43267167875709295,0.48522434502860146 +108,0.43267167875709295,0.48507276054523996 +109,0.43267167875709295,0.30038822637635615 +110,0.43267167875709295,0.4838794349338454 +111,0.43267167875709295,0.565360107700981 +112,0.43267167875709295,0.49094011858392633 +113,0.43267167875709295,0.48478818514289734 +114,0.43267167875709295,0.48741181700852 +115,0.43267167875709295,0.48438348109967383 +116,0.43267167875709295,0.5030806386532002 +117,0.43267167875709295,0.4863110951661063 +118,0.43267167875709295,0.6301163653980606 +119,0.43267167875709295,0.5694525162406746 +120,0.43267167875709295,0.5000368418531943 +121,0.43267167875709295,0.49877437904918154 +122,0.43267167875709295,0.48781178179495954 +123,0.43267167875709295,0.6351389979285045 +124,0.43267167875709295,0.6382532869424554 +125,0.43267167875709295,0.4988093159398747 +126,0.43267167875709295,0.5647747201637873 +127,0.43267167875709295,0.19090426820175177 +128,0.43267167875709295,0.5357416929735256 +129,0.43267167875709295,0.7477584920717685 +130,0.43267167875709295,0.6350407088820357 +1,1.578012970128081,0.4965641962922562 +2,1.578012970128081,0.5247843285811055 +3,1.578012970128081,0.3845597800678783 +4,1.578012970128081,0.5028203738549648 +5,1.578012970128081,0.5129760163809649 +6,1.578012970128081,0.5169643927232201 +7,1.578012970128081,0.5160265075918842 +8,1.578012970128081,0.4512003950954323 +9,1.578012970128081,0.5109352492045877 +10,1.578012970128081,0.3296589575653253 +11,1.578012970128081,0.5157155064787767 +12,1.578012970128081,0.4871737615354997 +13,1.578012970128081,0.4987625225535137 +14,1.578012970128081,0.3667744544240332 +15,1.578012970128081,0.5159686704209479 +16,1.578012970128081,0.5122075642427704 +17,1.578012970128081,0.4275486123190269 +18,1.578012970128081,0.7304029381487399 +19,1.578012970128081,0.5160743217938116 +20,1.578012970128081,0.5224049210625078 +21,1.578012970128081,0.45997643521757575 +22,1.578012970128081,0.41275359875159945 +23,1.578012970128081,0.5089420168577464 +24,1.578012970128081,0.3666668922635158 +25,1.578012970128081,0.437284216494967 +26,1.578012970128081,0.4350450668197641 +27,1.578012970128081,0.5105229817859189 +28,1.578012970128081,0.43905362853615665 +29,1.578012970128081,0.42807974633695506 +30,1.578012970128081,0.44554508245939467 +31,1.578012970128081,0.8341029105475616 +32,1.578012970128081,0.49982866061429415 +33,1.578012970128081,0.5128000000675811 +34,1.578012970128081,0.8334865364493659 +35,1.578012970128081,0.5186612123525782 +36,1.578012970128081,0.5140806484951363 +37,1.578012970128081,0.36943746678992206 +38,1.578012970128081,0.44337690167423444 +39,1.578012970128081,0.5108191658411548 +40,1.578012970128081,0.4927617911000383 +41,1.578012970128081,0.4671904485380679 +42,1.578012970128081,0.5159762974458898 +43,1.578012970128081,0.4991285421908544 +44,1.578012970128081,0.4327573514571974 +45,1.578012970128081,0.36134580721613047 +46,1.578012970128081,0.439316097121604 +47,1.578012970128081,0.3639711398687955 +48,1.578012970128081,0.4378106991076242 +49,1.578012970128081,0.4388917548861002 +50,1.578012970128081,0.6071418886367287 +51,1.578012970128081,0.4426743114405818 +52,1.578012970128081,0.694435477842031 +53,1.578012970128081,0.44429713132332066 +54,1.578012970128081,0.4429977232940618 +55,1.578012970128081,0.19014780848241838 +56,1.578012970128081,0.38459945547115165 +57,1.578012970128081,0.5059076069123708 +58,1.578012970128081,0.44571894933124173 +59,1.578012970128081,0.5123505841783229 +60,1.578012970128081,0.5106883970980229 +61,1.578012970128081,0.6817922448755838 +62,1.578012970128081,0.5167164910763721 +63,1.578012970128081,0.5013677911666912 +64,1.578012970128081,0.5228185134518389 +65,1.578012970128081,0.6302774803932369 +66,1.578012970128081,0.49695282184691386 +67,1.578012970128081,0.4445927491560597 +68,1.578012970128081,0.5120147129730389 +69,1.578012970128081,0.5173026156730453 +70,1.578012970128081,0.5099980129651843 +71,1.578012970128081,0.5113189715253562 +72,1.578012970128081,0.3623392030186811 +73,1.578012970128081,0.2959078900564308 +74,1.578012970128081,0.4334171895375424 +75,1.578012970128081,0.4463279167959184 +76,1.578012970128081,0.7300210031012453 +77,1.578012970128081,0.85783155411615 +78,1.578012970128081,0.36044719148486204 +79,1.578012970128081,0.5383162834975348 +80,1.578012970128081,0.5045978528213838 +81,1.578012970128081,0.5144806231781596 +82,1.578012970128081,0.41551599532953676 +83,1.578012970128081,0.51471097639924 +84,1.578012970128081,0.2948928228500861 +85,1.578012970128081,0.2882839084596049 +86,1.578012970128081,0.5248414409898753 +87,1.578012970128081,0.3633527973683014 +88,1.578012970128081,0.39841568158943996 +89,1.578012970128081,0.43459008131032767 +90,1.578012970128081,0.5011120989285084 +91,1.578012970128081,0.5031341506536486 +92,1.578012970128081,0.5173258281762945 +93,1.578012970128081,0.4428861604253988 +94,1.578012970128081,0.36983451004799517 +95,1.578012970128081,0.4377681483837434 +96,1.578012970128081,0.4953745580424795 +97,1.578012970128081,0.5018517364477799 +98,1.578012970128081,0.8464715931772558 +99,1.578012970128081,0.5147707942262878 +100,1.578012970128081,0.6444136691961653 +101,1.578012970128081,0.9731459447827623 +102,1.578012970128081,0.544384078900055 +103,1.578012970128081,0.8341284024452045 +104,1.578012970128081,0.4998912793018464 +105,1.578012970128081,0.6773116687314914 +106,1.578012970128081,0.4298266271033806 +107,1.578012970128081,0.5147756549713985 +108,1.578012970128081,0.51492723945476 +109,1.578012970128081,0.6996117736236439 +110,1.578012970128081,0.5161205650661546 +111,1.578012970128081,0.43463989229901906 +112,1.578012970128081,0.5090598814160737 +113,1.578012970128081,0.5152118148571028 +114,1.578012970128081,0.5125881829914801 +115,1.578012970128081,0.5156165189003262 +116,1.578012970128081,0.49691936134679987 +117,1.578012970128081,0.5136889048338937 +118,1.578012970128081,0.3698836346019395 +119,1.578012970128081,0.43054748375932533 +120,1.578012970128081,0.4999631581468057 +121,1.578012970128081,0.5012256209508186 +122,1.578012970128081,0.5121882182050403 +123,1.578012970128081,0.3648610020714955 +124,1.578012970128081,0.3617467130575446 +125,1.578012970128081,0.5011906840601253 +126,1.578012970128081,0.43522527983621273 +127,1.578012970128081,0.8090957317982482 +128,1.578012970128081,0.46425830702647436 +129,1.578012970128081,0.2522415079282316 +130,1.578012970128081,0.36495929111796427 diff --git a/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_omegabysite.txt b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_omegabysite.txt new file mode 100644 index 00000000..2e2bda25 --- /dev/null +++ b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_omegabysite.txt @@ -0,0 +1,136 @@ +# Omega fit to each site after fixing tree and all other parameters. +# Fits compared to null model of omega = 1. +# P-values NOT corrected for multiple testing, so consider Q-values too. +# Q-values computed separately for omega > and < 1 # Will fit different synonymous rate for each site. +# +site omega P dLnL Q +1 1.000 1 0.000 1 +95 0.000 0.747 0.052 1 +94 0.000 0.926 0.004 1 +93 0.000 0.96 0.001 1 +92 1.000 1 0.000 1 +91 1.000 1 0.000 1 +90 1.000 1 0.000 1 +89 0.000 0.616 0.125 1 +88 0.000 0.22 0.752 1 +87 0.000 0.918 0.005 1 +86 1.000 1 0.000 1 +85 0.000 0.214 0.771 1 +84 0.000 0.0247 2.524 1 +83 1.000 1 0.000 1 +96 1.000 1 0.000 1 +82 0.000 0.327 0.479 1 +80 1.000 1 0.000 1 +79 1.000 1 0.000 1 +78 0.000 0.623 0.121 1 +77 100.000 0.131 1.140 1 +76 100.000 0.047 1.972 1 +75 0.000 0.882 0.011 1 +74 0.000 0.549 0.180 1 +73 0.000 0.39 0.370 1 +72 0.000 0.884 0.011 1 +71 1.000 1 0.000 1 +70 1.000 1 0.000 1 +69 1.000 1 0.000 1 +68 1.000 1 0.000 1 +81 1.000 1 0.000 1 +97 1.000 1 0.000 1 +98 2.256 0.481 0.248 1 +99 1.000 1 0.000 1 +128 1.000 0.999 0.000 1 +127 0.965 0.978 0.000 1 +126 0.000 0.645 0.106 1 +125 1.000 1 0.000 1 +124 0.000 0.841 0.020 1 +123 0.000 0.742 0.054 1 +122 1.000 1 0.000 1 +121 1.000 1 0.000 1 +120 1.000 1 0.000 1 +119 0.000 0.551 0.177 1 +118 0.000 0.759 0.047 1 +117 1.000 1 0.000 1 +116 1.000 1 0.000 1 +115 1.000 1 0.000 1 +114 1.000 1 0.000 1 +113 1.000 1 0.000 1 +112 1.000 1 0.000 1 +111 0.000 0.758 0.048 1 +110 1.000 1 0.000 1 +109 92.450 0.256 0.644 1 +108 1.000 1 0.000 1 +107 1.000 1 0.000 1 +106 0.000 0.852 0.017 1 +105 100.000 0.66 0.097 1 +104 1.000 1 0.000 1 +103 4.282 0.253 0.655 1 +102 0.344 0.39 0.370 1 +101 11.091 0.0329 2.275 1 +100 1.305 0.858 0.016 1 +67 0.000 0.725 0.062 1 +66 1.000 1 0.000 1 +65 0.817 0.889 0.010 1 +64 1.000 1 0.000 1 +30 0.000 0.945 0.002 1 +29 0.000 0.492 0.236 1 +28 0.000 0.816 0.027 1 +27 1.000 1 0.000 1 +26 0.000 0.595 0.142 1 +25 0.000 0.801 0.032 1 +24 0.000 0.7 0.074 1 +23 1.000 1 0.000 1 +22 0.000 0.329 0.477 1 +21 0.000 0.974 0.001 1 +20 1.000 1 0.000 1 +19 1.000 1 0.000 1 +18 100.000 0.0882 1.453 1 +17 0.000 0.462 0.271 1 +16 1.000 1 0.000 1 +15 1.000 1 0.000 1 +14 0.000 0.745 0.053 1 +13 1.000 1 0.000 1 +12 1.000 1 0.000 1 +11 1.000 1 0.000 1 +10 0.000 0.0814 1.519 1 +9 1.000 1 0.000 1 +8 0.999 0.999 0.000 1 +7 1.000 1 0.000 1 +6 1.000 1 0.000 1 +5 1.000 1 0.000 1 +4 1.000 1 0.000 1 +3 0.000 0.202 0.815 1 +2 1.000 1 0.000 1 +31 3.976 0.271 0.606 1 +129 0.000 0.0218 2.629 1 +32 1.000 1 0.000 1 +34 95.114 0.244 0.680 1 +63 1.000 1 0.000 1 +62 1.000 1 0.000 1 +61 10.615 0.136 1.113 1 +60 1.000 1 0.000 1 +59 1.000 1 0.000 1 +58 0.000 0.96 0.001 1 +57 1.000 1 0.000 1 +56 0.000 0.917 0.005 1 +55 0.000 0.741 0.055 1 +54 0.000 0.769 0.043 1 +53 0.000 0.928 0.004 1 +52 100.000 0.313 0.509 1 +51 0.000 0.97 0.001 1 +50 94.079 0.515 0.212 1 +49 0.000 0.806 0.030 1 +48 0.000 0.805 0.030 1 +47 0.000 0.61 0.130 1 +46 0.000 0.932 0.004 1 +45 0.000 0.857 0.016 1 +44 0.000 0.665 0.094 1 +43 1.000 1 0.000 1 +42 1.000 1 0.000 1 +41 1.000 0.999 0.000 1 +40 1.000 1 0.000 1 +39 1.000 1 0.000 1 +38 0.000 0.844 0.019 1 +37 0.000 0.787 0.037 1 +36 1.000 1 0.000 1 +35 1.000 1 0.000 1 +33 1.000 1 0.000 1 +130 0.000 0.525 0.202 1 \ No newline at end of file diff --git a/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_posteriorprobabilities.csv b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_posteriorprobabilities.csv new file mode 100644 index 00000000..bf6737cc --- /dev/null +++ b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_posteriorprobabilities.csv @@ -0,0 +1,131 @@ +site,p(omega > 1) +101,0.9731459447827623 +77,0.85783155411615 +98,0.8464715931772558 +103,0.8341284024452045 +31,0.8341029105475616 +34,0.8334865364493659 +127,0.8090957317982482 +18,0.7304029381487399 +76,0.7300210031012453 +109,0.6996117736236439 +52,0.694435477842031 +61,0.6817922448755838 +105,0.6773116687314914 +100,0.6444136691961653 +65,0.6302774803932369 +50,0.6071418886367287 +102,0.544384078900055 +79,0.5383162834975348 +86,0.5248414409898753 +2,0.5247843285811055 +64,0.5228185134518389 +20,0.5224049210625078 +35,0.5186612123525782 +92,0.5173258281762945 +69,0.5173026156730453 +6,0.5169643927232201 +62,0.5167164910763721 +110,0.5161205650661546 +19,0.5160743217938116 +7,0.5160265075918842 +42,0.5159762974458898 +15,0.5159686704209479 +11,0.5157155064787767 +115,0.5156165189003262 +113,0.5152118148571028 +108,0.51492723945476 +107,0.5147756549713985 +99,0.5147707942262878 +83,0.51471097639924 +81,0.5144806231781596 +36,0.5140806484951363 +117,0.5136889048338937 +5,0.5129760163809649 +33,0.5128000000675811 +114,0.5125881829914801 +59,0.5123505841783229 +16,0.5122075642427704 +122,0.5121882182050403 +68,0.5120147129730389 +71,0.5113189715253562 +9,0.5109352492045877 +39,0.5108191658411548 +60,0.5106883970980229 +27,0.5105229817859189 +70,0.5099980129651843 +112,0.5090598814160737 +23,0.5089420168577464 +57,0.5059076069123708 +80,0.5045978528213838 +91,0.5031341506536486 +4,0.5028203738549648 +97,0.5018517364477799 +63,0.5013677911666912 +121,0.5012256209508186 +125,0.5011906840601253 +90,0.5011120989285084 +120,0.4999631581468057 +104,0.4998912793018464 +32,0.49982866061429415 +43,0.4991285421908544 +13,0.4987625225535137 +66,0.49695282184691386 +116,0.49691936134679987 +1,0.4965641962922562 +96,0.4953745580424795 +40,0.4927617911000383 +12,0.4871737615354997 +41,0.4671904485380679 +128,0.46425830702647436 +21,0.45997643521757575 +8,0.4512003950954323 +75,0.4463279167959184 +58,0.44571894933124173 +30,0.44554508245939467 +67,0.4445927491560597 +53,0.44429713132332066 +38,0.44337690167423444 +54,0.4429977232940618 +93,0.4428861604253988 +51,0.4426743114405818 +46,0.439316097121604 +28,0.43905362853615665 +49,0.4388917548861002 +48,0.4378106991076242 +95,0.4377681483837434 +25,0.437284216494967 +126,0.43522527983621273 +26,0.4350450668197641 +111,0.43463989229901906 +89,0.43459008131032767 +74,0.4334171895375424 +44,0.4327573514571974 +119,0.43054748375932533 +106,0.4298266271033806 +29,0.42807974633695506 +17,0.4275486123190269 +82,0.41551599532953676 +22,0.41275359875159945 +88,0.39841568158943996 +56,0.38459945547115165 +3,0.3845597800678783 +118,0.3698836346019395 +94,0.36983451004799517 +37,0.36943746678992206 +14,0.3667744544240332 +24,0.3666668922635158 +130,0.36495929111796427 +123,0.3648610020714955 +47,0.3639711398687955 +87,0.3633527973683014 +72,0.3623392030186811 +124,0.3617467130575446 +45,0.36134580721613047 +78,0.36044719148486204 +10,0.3296589575653253 +73,0.2959078900564308 +84,0.2948928228500861 +85,0.2882839084596049 +129,0.2522415079282316 +55,0.19014780848241838 diff --git a/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_tree.newick b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_tree.newick new file mode 100644 index 00000000..40a2a2c9 --- /dev/null +++ b/tests/expected_NP_test_results/ExpCM_NP_prefs_short_gammaomega_tree.newick @@ -0,0 +1 @@ +(((((((((1984.68_15_A/DaNang/DN329/2008_HOST_Human_H1N1:0.03365,1980.70_58_A/Canterbury/106/2004_HOST_Human_H1N1:0.00001):0.01729,1976.54_75_A/Canterbury/9/2000_HOST_Human_H1N1:0.00784):0.06198,1956.50_150_A/Maryland/2/1980_HOST_Human_H1N1:0.00905):0.03448,((1918.50_2534_A/Brevig_Mission/1/1918_HOST_Human_H1N1:0.10965,1936.50_945_A/Henry/1936_HOST_Human_H1N1:0.09538):0.01251,1946.50_961_A/Cameron/1946_HOST_Human_H1N1:0.03452):0.01818):0.06323,1950.50_1400_A/Fort_Warren/1/1950_HOST_Human_H1N1:0.01765):0.00762,1960.50_597_A/Ann_Arbor/6/1960_HOST_Human_H2N2:0.00001):0.03460,1964.50_1934_A/Taiwan/1964_HOST_Human_H2N2:0.02595):0.00682,1968.50_273_A/Georgia/122/68_HOST_Human_H3N2:0.03585):0.01969,((1992.50_41_A/Beijing/32/1992_HOST_Human_H3N2:0.00815,(((2000.01_1_A/New_York/433/2000_HOST_Human_H3N2:0.00703,((2008.16_16_A/Boston/64/2008_HOST_Human_H3N2:0.00813,2012.07_122_A/California/17/2012_HOST_Human_H3N2:0.04298):0.00877,2004.59_17_A/Canterbury/12/2004_HOST_Human_H3N2:0.01680):0.05327):0.02714,1996.82_163_A/Lyon/1781/1996_HOST_Human_H3N2:0.00786):0.02643,1988.16_748_A/Netherlands/450/1988_HOST_Human_H3N2:0.00817):0.00852):0.06978,1972.50_48_A/Tokyo/31/72_HOST_Human_H3N2:0.00001):0.04247):0.00000; diff --git a/tests/expected_NP_test_results/YNGKP_M0_omegabysite.txt b/tests/expected_NP_test_results/YNGKP_M0_omegabysite.txt index 37f6b25f..47756c5e 100644 --- a/tests/expected_NP_test_results/YNGKP_M0_omegabysite.txt +++ b/tests/expected_NP_test_results/YNGKP_M0_omegabysite.txt @@ -128,7 +128,7 @@ site omega P dLnL Q 57 0.999 0.999 0.000 1 52 100.000 0.417 0.330 1 51 0.000 0.963 0.001 1 -50 83.553 0.468 0.263 1 +50 82.074 0.468 0.263 1 43 0.000 0.962 0.001 1 42 1.000 0.999 0.000 1 41 0.999 0.999 0.000 1 diff --git a/tests/expected_NP_test_results/YNGKP_M5_omegabycategory.csv b/tests/expected_NP_test_results/YNGKP_M5_omegabycategory.csv new file mode 100644 index 00000000..1a70bb2a --- /dev/null +++ b/tests/expected_NP_test_results/YNGKP_M5_omegabycategory.csv @@ -0,0 +1,261 @@ +site,omega,post_probability +1,0.006524227985077992,0.5358998869029046 +2,0.006524227985077992,0.49959442543120813 +3,0.006524227985077992,0.6031153926894799 +4,0.006524227985077992,0.49504218242076015 +5,0.006524227985077992,0.4969874449859769 +6,0.006524227985077992,0.4973037795397791 +7,0.006524227985077992,0.49913042126756935 +8,0.006524227985077992,0.5990259940291801 +9,0.006524227985077992,0.5015429484702248 +10,0.006524227985077992,0.6979830128497808 +11,0.006524227985077992,0.5026191262448946 +12,0.006524227985077992,0.48954164225489377 +13,0.006524227985077992,0.5358998869029046 +14,0.006524227985077992,0.6963693264705739 +15,0.006524227985077992,0.5002976667435969 +16,0.006524227985077992,0.5034163284253028 +17,0.006524227985077992,0.6024311869008321 +18,0.006524227985077992,0.04169457960228582 +19,0.006524227985077992,0.49988768774250114 +20,0.006524227985077992,0.48954164225489377 +21,0.006524227985077992,0.5009213911516522 +22,0.006524227985077992,0.6073272135651896 +23,0.006524227985077992,0.5002976667435969 +24,0.006524227985077992,0.6955778041048722 +25,0.006524227985077992,0.5989434041103244 +26,0.006524227985077992,0.6111426840892549 +27,0.006524227985077992,0.5058858553334159 +28,0.006524227985077992,0.6031153926894799 +29,0.006524227985077992,0.5957426555231262 +30,0.006524227985077992,0.6059688461563784 +31,0.006524227985077992,0.0027197452029320097 +32,0.006524227985077992,0.5358998869029046 +33,0.006524227985077992,0.4983364846975298 +34,0.006524227985077992,0.0018514185490384547 +35,0.006524227985077992,0.5073380368270125 +36,0.006524227985077992,0.4983364846975298 +37,0.006524227985077992,0.7013664068078325 +38,0.006524227985077992,0.599658067389437 +39,0.006524227985077992,0.5019107420303388 +40,0.006524227985077992,0.49794876457277926 +41,0.006524227985077992,0.49483740495480094 +42,0.006524227985077992,0.49504218242076015 +43,0.006524227985077992,0.5358998869029046 +44,0.006524227985077992,0.6071438249990738 +45,0.006524227985077992,0.7015505741031152 +46,0.006524227985077992,0.6058676411095263 +47,0.006524227985077992,0.696872658598882 +48,0.006524227985077992,0.6029977311819918 +49,0.006524227985077992,0.600454487364226 +50,0.006524227985077992,0.042566012111114264 +51,0.006524227985077992,0.5034163284253028 +52,0.006524227985077992,0.04133057193369219 +53,0.006524227985077992,0.5967259708005067 +54,0.006524227985077992,0.6059688461563784 +55,0.006524227985077992,0.889350711944713 +56,0.006524227985077992,0.6833037225395245 +57,0.006524227985077992,0.49483740495480094 +58,0.006524227985077992,0.5934554978717903 +59,0.006524227985077992,0.49498125578131486 +60,0.006524227985077992,0.5067139203706442 +61,0.006524227985077992,0.05816195655985238 +62,0.006524227985077992,0.5048852238200536 +63,0.006524227985077992,0.5303650531379458 +64,0.006524227985077992,0.4902382255956194 +65,0.006524227985077992,0.06334882501755223 +66,0.006524227985077992,0.5358998869029046 +67,0.006524227985077992,0.5955700913268188 +68,0.006524227985077992,0.4972510379979353 +69,0.006524227985077992,0.5015429484702248 +70,0.006524227985077992,0.5012823741248555 +71,0.006524227985077992,0.5037900999786412 +72,0.006524227985077992,0.6979522333704465 +73,0.006524227985077992,0.7735225647618619 +74,0.006524227985077992,0.6093782814458781 +75,0.006524227985077992,0.6063823253833748 +76,0.006524227985077992,0.041206562036424074 +77,0.006524227985077992,0.0018463067098041812 +78,0.006524227985077992,0.6984607134492413 +79,0.006524227985077992,0.48140647316835417 +80,0.006524227985077992,0.5026191262448946 +81,0.006524227985077992,0.5026191262448946 +82,0.006524227985077992,0.6063492372773509 +83,0.006524227985077992,0.5001341314297927 +84,0.006524227985077992,0.7044748787691012 +85,0.006524227985077992,0.7800663682902752 +86,0.006524227985077992,0.4986353383856815 +87,0.006524227985077992,0.7014427363819216 +88,0.006524227985077992,0.6062273949866378 +89,0.006524227985077992,0.6045015618844951 +90,0.006524227985077992,0.48622026369771376 +91,0.006524227985077992,0.49913042126756935 +92,0.006524227985077992,0.5002976667435969 +93,0.006524227985077992,0.6092922104175904 +94,0.006524227985077992,0.7021043969506146 +95,0.006524227985077992,0.6032893541645739 +96,0.006524227985077992,0.5303650531379458 +97,0.006524227985077992,0.49794876457277926 +98,0.006524227985077992,0.0025885340526177365 +99,0.006524227985077992,0.5113347648097987 +100,0.006524227985077992,0.06152601933771276 +101,0.006524227985077992,5.163612347031729e-06 +102,0.006524227985077992,0.09233797324561646 +103,0.006524227985077992,0.002711118554480184 +104,0.006524227985077992,0.5108023663526002 +105,0.006524227985077992,0.046429947252747315 +106,0.006524227985077992,0.6276413385282652 +107,0.006524227985077992,0.5026191262448946 +108,0.006524227985077992,0.4972510379979353 +109,0.006524227985077992,0.03983465656411632 +110,0.006524227985077992,0.4991067701348507 +111,0.006524227985077992,0.6042662356522709 +112,0.006524227985077992,0.4977167666815409 +113,0.006524227985077992,0.49913042126756935 +114,0.006524227985077992,0.5026191262448946 +115,0.006524227985077992,0.5026191262448946 +116,0.006524227985077992,0.5303650531379458 +117,0.006524227985077992,0.5025656651811286 +118,0.006524227985077992,0.6933231330783429 +119,0.006524227985077992,0.5984793873879671 +120,0.006524227985077992,0.5108023663526002 +121,0.006524227985077992,0.49988768774250114 +122,0.006524227985077992,0.49504218242076015 +123,0.006524227985077992,0.6978552594923726 +124,0.006524227985077992,0.6978059036475548 +125,0.006524227985077992,0.5009213911516522 +126,0.006524227985077992,0.6051825393219138 +127,0.006524227985077992,0.0028355177498400118 +128,0.006524227985077992,0.5034163284253028 +129,0.006524227985077992,0.7844202913779701 +130,0.006524227985077992,0.6999315129079735 +1,0.23117145559920588,0.4641001130970955 +2,0.23117145559920588,0.500405574568792 +3,0.23117145559920588,0.39688460731052017 +4,0.23117145559920588,0.50495781757924 +5,0.23117145559920588,0.5030125550140231 +6,0.23117145559920588,0.5026962204602208 +7,0.23117145559920588,0.5008695787324307 +8,0.23117145559920588,0.40097400597081995 +9,0.23117145559920588,0.4984570515297752 +10,0.23117145559920588,0.30201698715021924 +11,0.23117145559920588,0.4973808737551055 +12,0.23117145559920588,0.5104583577451063 +13,0.23117145559920588,0.4641001130970955 +14,0.23117145559920588,0.30363067352942613 +15,0.23117145559920588,0.499702333256403 +16,0.23117145559920588,0.49658367157469707 +17,0.23117145559920588,0.39756881309916786 +18,0.23117145559920588,0.9583054203977142 +19,0.23117145559920588,0.5001123122574989 +20,0.23117145559920588,0.5104583577451063 +21,0.23117145559920588,0.4990786088483477 +22,0.23117145559920588,0.3926727864348104 +23,0.23117145559920588,0.499702333256403 +24,0.23117145559920588,0.3044221958951278 +25,0.23117145559920588,0.40105659588967557 +26,0.23117145559920588,0.3888573159107452 +27,0.23117145559920588,0.49411414466658404 +28,0.23117145559920588,0.39688460731052017 +29,0.23117145559920588,0.4042573444768739 +30,0.23117145559920588,0.3940311538436217 +31,0.23117145559920588,0.9972802547970679 +32,0.23117145559920588,0.4641001130970955 +33,0.23117145559920588,0.5016635153024702 +34,0.23117145559920588,0.9981485814509615 +35,0.23117145559920588,0.49266196317298755 +36,0.23117145559920588,0.5016635153024702 +37,0.23117145559920588,0.2986335931921674 +38,0.23117145559920588,0.400341932610563 +39,0.23117145559920588,0.49808925796966125 +40,0.23117145559920588,0.5020512354272207 +41,0.23117145559920588,0.5051625950451991 +42,0.23117145559920588,0.50495781757924 +43,0.23117145559920588,0.4641001130970955 +44,0.23117145559920588,0.3928561750009262 +45,0.23117145559920588,0.29844942589688483 +46,0.23117145559920588,0.3941323588904737 +47,0.23117145559920588,0.303127341401118 +48,0.23117145559920588,0.3970022688180082 +49,0.23117145559920588,0.39954551263577404 +50,0.23117145559920588,0.9574339878888858 +51,0.23117145559920588,0.49658367157469707 +52,0.23117145559920588,0.9586694280663078 +53,0.23117145559920588,0.40327402919949323 +54,0.23117145559920588,0.3940311538436217 +55,0.23117145559920588,0.11064928805528687 +56,0.23117145559920588,0.3166962774604755 +57,0.23117145559920588,0.5051625950451991 +58,0.23117145559920588,0.40654450212820975 +59,0.23117145559920588,0.5050187442186851 +60,0.23117145559920588,0.49328607962935567 +61,0.23117145559920588,0.9418380434401477 +62,0.23117145559920588,0.4951147761799463 +63,0.23117145559920588,0.4696349468620542 +64,0.23117145559920588,0.5097617744043805 +65,0.23117145559920588,0.9366511749824477 +66,0.23117145559920588,0.4641001130970955 +67,0.23117145559920588,0.4044299086731811 +68,0.23117145559920588,0.5027489620020646 +69,0.23117145559920588,0.4984570515297752 +70,0.23117145559920588,0.49871762587514445 +71,0.23117145559920588,0.49620990002135873 +72,0.23117145559920588,0.3020477666295535 +73,0.23117145559920588,0.22647743523813815 +74,0.23117145559920588,0.3906217185541219 +75,0.23117145559920588,0.39361767461662533 +76,0.23117145559920588,0.958793437963576 +77,0.23117145559920588,0.9981536932901958 +78,0.23117145559920588,0.3015392865507587 +79,0.23117145559920588,0.5185935268316458 +80,0.23117145559920588,0.4973808737551055 +81,0.23117145559920588,0.4973808737551055 +82,0.23117145559920588,0.39365076272264915 +83,0.23117145559920588,0.49986586857020726 +84,0.23117145559920588,0.2955251212308987 +85,0.23117145559920588,0.21993363170972474 +86,0.23117145559920588,0.5013646616143185 +87,0.23117145559920588,0.2985572636180785 +88,0.23117145559920588,0.3937726050133623 +89,0.23117145559920588,0.3954984381155049 +90,0.23117145559920588,0.5137797363022861 +91,0.23117145559920588,0.5008695787324307 +92,0.23117145559920588,0.499702333256403 +93,0.23117145559920588,0.39070778958240954 +94,0.23117145559920588,0.29789560304938545 +95,0.23117145559920588,0.3967106458354261 +96,0.23117145559920588,0.4696349468620542 +97,0.23117145559920588,0.5020512354272207 +98,0.23117145559920588,0.9974114659473823 +99,0.23117145559920588,0.4886652351902013 +100,0.23117145559920588,0.9384739806622872 +101,0.23117145559920588,0.9999948363876529 +102,0.23117145559920588,0.9076620267543836 +103,0.23117145559920588,0.9972888814455197 +104,0.23117145559920588,0.4891976336473997 +105,0.23117145559920588,0.9535700527472526 +106,0.23117145559920588,0.3723586614717347 +107,0.23117145559920588,0.4973808737551055 +108,0.23117145559920588,0.5027489620020646 +109,0.23117145559920588,0.9601653434358838 +110,0.23117145559920588,0.5008932298651492 +111,0.23117145559920588,0.39573376434772917 +112,0.23117145559920588,0.5022832333184591 +113,0.23117145559920588,0.5008695787324307 +114,0.23117145559920588,0.4973808737551055 +115,0.23117145559920588,0.4973808737551055 +116,0.23117145559920588,0.4696349468620542 +117,0.23117145559920588,0.49743433481887156 +118,0.23117145559920588,0.3066768669216571 +119,0.23117145559920588,0.4015206126120328 +120,0.23117145559920588,0.4891976336473997 +121,0.23117145559920588,0.5001123122574989 +122,0.23117145559920588,0.50495781757924 +123,0.23117145559920588,0.3021447405076274 +124,0.23117145559920588,0.30219409635244526 +125,0.23117145559920588,0.4990786088483477 +126,0.23117145559920588,0.39481746067808626 +127,0.23117145559920588,0.99716448225016 +128,0.23117145559920588,0.49658367157469707 +129,0.23117145559920588,0.2155797086220298 +130,0.23117145559920588,0.3000684870920265 diff --git a/tests/expected_NP_test_results/YNGKP_M5_omegabysite.txt b/tests/expected_NP_test_results/YNGKP_M5_omegabysite.txt index e2e54eda..7f94ef76 100644 --- a/tests/expected_NP_test_results/YNGKP_M5_omegabysite.txt +++ b/tests/expected_NP_test_results/YNGKP_M5_omegabysite.txt @@ -68,7 +68,7 @@ site omega P dLnL Q 108 1.000 1 0.000 1 115 0.000 0.959 0.001 1 109 100.000 0.318 0.498 1 -105 98.202 0.796 0.033 1 +105 100.000 0.796 0.033 1 83 1.000 1 0.000 1 103 1.015 0.991 0.000 1 110 1.000 1 0.000 1 @@ -126,9 +126,9 @@ site omega P dLnL Q 60 0.000 0.966 0.001 1 59 0.000 0.964 0.001 1 57 0.999 0.999 0.000 1 -52 96.417 0.416 0.331 1 +52 96.027 0.416 0.331 1 51 0.000 0.963 0.001 1 -50 100.000 0.467 0.264 1 +50 90.361 0.467 0.264 1 43 0.000 0.962 0.001 1 42 1.000 0.999 0.000 1 41 0.999 0.999 0.000 1 diff --git a/tests/expected_NP_test_results/YNGKP_M5_posteriorprobabilities.csv b/tests/expected_NP_test_results/YNGKP_M5_posteriorprobabilities.csv new file mode 100644 index 00000000..3dae5eb0 --- /dev/null +++ b/tests/expected_NP_test_results/YNGKP_M5_posteriorprobabilities.csv @@ -0,0 +1,131 @@ +site,p(omega > 1) +1,0.0 +98,0.0 +96,0.0 +95,0.0 +94,0.0 +93,0.0 +92,0.0 +91,0.0 +90,0.0 +89,0.0 +88,0.0 +87,0.0 +86,0.0 +85,0.0 +84,0.0 +83,0.0 +82,0.0 +81,0.0 +80,0.0 +79,0.0 +78,0.0 +77,0.0 +76,0.0 +75,0.0 +74,0.0 +73,0.0 +72,0.0 +71,0.0 +70,0.0 +69,0.0 +68,0.0 +97,0.0 +99,0.0 +2,0.0 +100,0.0 +129,0.0 +128,0.0 +127,0.0 +126,0.0 +125,0.0 +124,0.0 +123,0.0 +122,0.0 +121,0.0 +120,0.0 +119,0.0 +118,0.0 +117,0.0 +116,0.0 +115,0.0 +114,0.0 +113,0.0 +112,0.0 +111,0.0 +110,0.0 +109,0.0 +108,0.0 +107,0.0 +106,0.0 +105,0.0 +104,0.0 +103,0.0 +102,0.0 +101,0.0 +67,0.0 +66,0.0 +65,0.0 +64,0.0 +31,0.0 +30,0.0 +29,0.0 +28,0.0 +27,0.0 +26,0.0 +25,0.0 +24,0.0 +23,0.0 +22,0.0 +21,0.0 +20,0.0 +19,0.0 +18,0.0 +17,0.0 +16,0.0 +15,0.0 +14,0.0 +13,0.0 +12,0.0 +11,0.0 +10,0.0 +9,0.0 +8,0.0 +7,0.0 +6,0.0 +5,0.0 +4,0.0 +3,0.0 +32,0.0 +33,0.0 +34,0.0 +50,0.0 +63,0.0 +62,0.0 +61,0.0 +60,0.0 +59,0.0 +58,0.0 +57,0.0 +56,0.0 +55,0.0 +54,0.0 +53,0.0 +52,0.0 +51,0.0 +49,0.0 +35,0.0 +48,0.0 +47,0.0 +46,0.0 +45,0.0 +44,0.0 +43,0.0 +42,0.0 +41,0.0 +40,0.0 +39,0.0 +38,0.0 +37,0.0 +36,0.0 +130,0.0 diff --git a/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_diffprefsbysite.txt b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_diffprefsbysite.txt deleted file mode 100644 index 57bde145..00000000 --- a/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_diffprefsbysite.txt +++ /dev/null @@ -1,134 +0,0 @@ -# Differential preferences fit to each site. -# Regularizing prior: ('invquadratic', 150.0, 0.5) -# -site dpi_A dpi_C dpi_D dpi_E dpi_F dpi_G dpi_H dpi_I dpi_K dpi_L dpi_M dpi_N dpi_P dpi_Q dpi_R dpi_S dpi_T dpi_V dpi_W dpi_Y half_sum_abs_dpi -120 -0.0067 -0.0028 -0.0048 -0.0085 -0.0017 -0.0112 -0.0028 -0.0075 -0.0113 -0.0093 -0.0022 -0.0065 -0.0040 -0.0051 -0.0186 -0.0109 -0.0089 -0.0081 0.1345 -0.0035 0.1345 -104 -0.0067 -0.0028 -0.0048 -0.0085 -0.0017 -0.0112 -0.0028 -0.0075 -0.0113 -0.0093 -0.0022 -0.0065 -0.0040 -0.0051 -0.0186 -0.0109 -0.0089 -0.0081 0.1345 -0.0035 0.1345 -39 -0.0066 -0.0026 -0.0048 -0.0084 0.1342 -0.0108 -0.0027 -0.0078 -0.0112 -0.0110 -0.0021 -0.0065 -0.0039 -0.0051 -0.0164 -0.0121 -0.0088 -0.0082 -0.0014 -0.0037 0.1342 -71 -0.0066 -0.0026 -0.0048 -0.0084 0.1342 -0.0108 -0.0027 -0.0078 -0.0112 -0.0110 -0.0021 -0.0065 -0.0039 -0.0051 -0.0164 -0.0121 -0.0088 -0.0082 -0.0014 -0.0037 0.1342 -66 -0.0062 -0.0021 -0.0044 -0.0080 -0.0013 -0.0103 -0.0024 -0.0101 -0.0111 -0.0090 0.1289 -0.0061 -0.0035 -0.0047 -0.0161 -0.0102 -0.0098 -0.0097 -0.0011 -0.0031 0.1289 -43 -0.0062 -0.0021 -0.0044 -0.0080 -0.0013 -0.0103 -0.0024 -0.0101 -0.0111 -0.0090 0.1289 -0.0061 -0.0035 -0.0047 -0.0161 -0.0102 -0.0098 -0.0097 -0.0011 -0.0031 0.1289 -32 -0.0062 -0.0021 -0.0044 -0.0080 -0.0013 -0.0103 -0.0024 -0.0101 -0.0111 -0.0090 0.1289 -0.0061 -0.0035 -0.0047 -0.0161 -0.0102 -0.0098 -0.0097 -0.0011 -0.0031 0.1289 -13 -0.0062 -0.0021 -0.0044 -0.0080 -0.0013 -0.0103 -0.0024 -0.0101 -0.0111 -0.0090 0.1289 -0.0061 -0.0035 -0.0047 -0.0161 -0.0102 -0.0098 -0.0097 -0.0011 -0.0031 0.1289 -1 -0.0062 -0.0021 -0.0044 -0.0080 -0.0013 -0.0103 -0.0024 -0.0101 -0.0111 -0.0090 0.1289 -0.0061 -0.0035 -0.0047 -0.0161 -0.0102 -0.0098 -0.0097 -0.0011 -0.0031 0.1289 -44 -0.0062 0.1262 -0.0044 -0.0079 -0.0015 -0.0105 -0.0024 -0.0070 -0.0107 -0.0086 -0.0018 -0.0060 -0.0035 -0.0047 -0.0174 -0.0106 -0.0084 -0.0075 -0.0014 -0.0058 0.1262 -82 -0.0061 -0.0021 -0.0046 -0.0079 -0.0013 -0.0102 0.1254 -0.0070 -0.0106 -0.0087 -0.0018 -0.0063 -0.0037 -0.0052 -0.0182 -0.0101 -0.0083 -0.0075 -0.0011 -0.0046 0.1254 -95 -0.0064 -0.0022 -0.0045 -0.0079 -0.0015 -0.0102 -0.0028 -0.0070 -0.0106 -0.0102 -0.0020 -0.0061 0.1245 -0.0048 -0.0158 -0.0118 -0.0086 -0.0075 -0.0013 -0.0032 0.1245 -89 -0.0064 -0.0022 -0.0045 -0.0079 -0.0015 -0.0102 -0.0028 -0.0070 -0.0106 -0.0102 -0.0020 -0.0061 0.1245 -0.0048 -0.0158 -0.0118 -0.0086 -0.0075 -0.0013 -0.0032 0.1245 -83 -0.0064 -0.0022 -0.0045 -0.0079 -0.0015 -0.0102 -0.0028 -0.0070 -0.0106 -0.0102 -0.0020 -0.0061 0.1245 -0.0048 -0.0158 -0.0118 -0.0086 -0.0075 -0.0013 -0.0032 0.1245 -97 -0.0060 -0.0041 -0.0045 -0.0077 -0.0014 -0.0100 -0.0037 -0.0068 -0.0104 -0.0083 -0.0017 -0.0062 -0.0034 -0.0045 -0.0153 -0.0100 -0.0081 -0.0073 -0.0011 0.1203 0.1203 -40 -0.0060 -0.0041 -0.0045 -0.0077 -0.0014 -0.0100 -0.0037 -0.0068 -0.0104 -0.0083 -0.0017 -0.0062 -0.0034 -0.0045 -0.0153 -0.0100 -0.0081 -0.0073 -0.0011 0.1203 0.1203 -111 -0.0060 -0.0041 -0.0045 -0.0077 -0.0014 -0.0100 -0.0037 -0.0068 -0.0104 -0.0083 -0.0017 -0.0062 -0.0034 -0.0045 -0.0153 -0.0100 -0.0081 -0.0073 -0.0011 0.1203 0.1203 -10 -0.0060 -0.0041 -0.0045 -0.0077 -0.0014 -0.0100 -0.0037 -0.0068 -0.0104 -0.0083 -0.0017 -0.0062 -0.0034 -0.0045 -0.0153 -0.0100 -0.0081 -0.0073 -0.0011 0.1203 0.1203 -78 -0.0060 -0.0041 -0.0045 -0.0077 -0.0014 -0.0100 -0.0037 -0.0068 -0.0104 -0.0083 -0.0017 -0.0062 -0.0034 -0.0045 -0.0153 -0.0100 -0.0081 -0.0073 -0.0011 0.1203 0.1203 -112 -0.0059 -0.0018 0.1161 -0.0079 -0.0011 -0.0119 -0.0023 -0.0065 -0.0100 -0.0080 -0.0016 -0.0084 -0.0032 -0.0043 -0.0148 -0.0095 -0.0078 -0.0072 -0.0009 -0.0029 0.1161 -51 -0.0059 -0.0018 0.1161 -0.0079 -0.0011 -0.0119 -0.0023 -0.0065 -0.0100 -0.0080 -0.0016 -0.0084 -0.0032 -0.0043 -0.0148 -0.0095 -0.0078 -0.0072 -0.0009 -0.0029 0.1161 -16 -0.0059 -0.0018 0.1161 -0.0079 -0.0011 -0.0119 -0.0023 -0.0065 -0.0100 -0.0080 -0.0016 -0.0084 -0.0032 -0.0043 -0.0148 -0.0095 -0.0078 -0.0072 -0.0009 -0.0029 0.1161 -128 -0.0059 -0.0018 0.1161 -0.0079 -0.0011 -0.0119 -0.0023 -0.0065 -0.0100 -0.0080 -0.0016 -0.0084 -0.0032 -0.0043 -0.0148 -0.0095 -0.0078 -0.0072 -0.0009 -0.0029 0.1161 -88 -0.0059 -0.0018 0.1161 -0.0079 -0.0011 -0.0119 -0.0023 -0.0065 -0.0100 -0.0080 -0.0016 -0.0084 -0.0032 -0.0043 -0.0148 -0.0095 -0.0078 -0.0072 -0.0009 -0.0029 0.1161 -72 -0.0059 -0.0018 0.1161 -0.0079 -0.0011 -0.0119 -0.0023 -0.0065 -0.0100 -0.0080 -0.0016 -0.0084 -0.0032 -0.0043 -0.0148 -0.0095 -0.0078 -0.0072 -0.0009 -0.0029 0.1161 -58 -0.0054 -0.0016 -0.0037 -0.0073 -0.0008 -0.0093 -0.0022 -0.0062 -0.0100 -0.0079 -0.0013 -0.0053 -0.0031 0.1080 -0.0170 -0.0092 -0.0075 -0.0067 -0.0007 -0.0025 0.1080 -20 -0.0054 -0.0016 -0.0037 -0.0073 -0.0008 -0.0093 -0.0022 -0.0062 -0.0100 -0.0079 -0.0013 -0.0053 -0.0031 0.1080 -0.0170 -0.0092 -0.0075 -0.0067 -0.0007 -0.0025 0.1080 -12 -0.0054 -0.0016 -0.0037 -0.0073 -0.0008 -0.0093 -0.0022 -0.0062 -0.0100 -0.0079 -0.0013 -0.0053 -0.0031 0.1080 -0.0170 -0.0092 -0.0075 -0.0067 -0.0007 -0.0025 0.1080 -42 -0.0054 -0.0016 -0.0037 -0.0073 -0.0008 -0.0093 -0.0022 -0.0062 -0.0100 -0.0079 -0.0013 -0.0053 -0.0031 0.1080 -0.0170 -0.0092 -0.0075 -0.0067 -0.0007 -0.0025 0.1080 -4 -0.0054 -0.0016 -0.0037 -0.0073 -0.0008 -0.0093 -0.0022 -0.0062 -0.0100 -0.0079 -0.0013 -0.0053 -0.0031 0.1080 -0.0170 -0.0092 -0.0075 -0.0067 -0.0007 -0.0025 0.1080 -122 -0.0054 -0.0016 -0.0037 -0.0073 -0.0008 -0.0093 -0.0022 -0.0062 -0.0100 -0.0079 -0.0013 -0.0053 -0.0031 0.1080 -0.0170 -0.0092 -0.0075 -0.0067 -0.0007 -0.0025 0.1080 -59 -0.0051 -0.0014 -0.0058 -0.0068 -0.0007 -0.0090 -0.0018 -0.0061 -0.0099 -0.0074 -0.0011 0.1035 -0.0027 -0.0038 -0.0139 -0.0112 -0.0073 -0.0064 -0.0005 -0.0025 0.1035 -21 -0.0051 -0.0014 -0.0058 -0.0068 -0.0007 -0.0090 -0.0018 -0.0061 -0.0099 -0.0074 -0.0011 0.1035 -0.0027 -0.0038 -0.0139 -0.0112 -0.0073 -0.0064 -0.0005 -0.0025 0.1035 -125 -0.0051 -0.0014 -0.0058 -0.0068 -0.0007 -0.0090 -0.0018 -0.0061 -0.0099 -0.0074 -0.0011 0.1035 -0.0027 -0.0038 -0.0139 -0.0112 -0.0073 -0.0064 -0.0005 -0.0025 0.1035 -124 -0.0051 -0.0014 -0.0058 -0.0068 -0.0007 -0.0090 -0.0018 -0.0061 -0.0099 -0.0074 -0.0011 0.1035 -0.0027 -0.0038 -0.0139 -0.0112 -0.0073 -0.0064 -0.0005 -0.0025 0.1035 -2 0.1016 -0.0013 -0.0034 -0.0070 -0.0006 -0.0091 -0.0016 -0.0059 -0.0092 -0.0073 -0.0011 -0.0050 -0.0028 -0.0037 -0.0138 -0.0089 -0.0100 -0.0080 -0.0004 -0.0022 0.1016 -27 0.1016 -0.0013 -0.0034 -0.0070 -0.0006 -0.0091 -0.0016 -0.0059 -0.0092 -0.0073 -0.0011 -0.0050 -0.0028 -0.0037 -0.0138 -0.0089 -0.0100 -0.0080 -0.0004 -0.0022 0.1016 -70 0.1016 -0.0013 -0.0038 -0.0067 -0.0006 -0.0091 -0.0016 -0.0059 -0.0092 -0.0073 -0.0011 -0.0050 -0.0028 -0.0037 -0.0138 -0.0089 -0.0100 -0.0080 -0.0004 -0.0022 0.1016 -129 0.1016 -0.0013 -0.0034 -0.0070 -0.0006 -0.0091 -0.0016 -0.0059 -0.0093 -0.0073 -0.0011 -0.0050 -0.0028 -0.0037 -0.0138 -0.0089 -0.0100 -0.0080 -0.0004 -0.0022 0.1016 -85 0.1016 -0.0013 -0.0035 -0.0070 -0.0006 -0.0091 -0.0016 -0.0059 -0.0093 -0.0073 -0.0011 -0.0050 -0.0028 -0.0037 -0.0138 -0.0089 -0.0100 -0.0080 -0.0004 -0.0022 0.1016 -22 0.1016 -0.0013 -0.0035 -0.0069 -0.0006 -0.0091 -0.0016 -0.0059 -0.0093 -0.0073 -0.0011 -0.0050 -0.0028 -0.0037 -0.0138 -0.0089 -0.0100 -0.0080 -0.0004 -0.0022 0.1016 -123 0.1016 -0.0013 -0.0037 -0.0067 -0.0006 -0.0091 -0.0016 -0.0059 -0.0093 -0.0073 -0.0011 -0.0050 -0.0028 -0.0037 -0.0138 -0.0089 -0.0100 -0.0080 -0.0004 -0.0022 0.1016 -96 -0.0049 -0.0012 -0.0033 -0.0065 -0.0005 -0.0087 -0.0015 0.0993 -0.0094 -0.0075 -0.0030 -0.0048 -0.0026 -0.0036 -0.0138 -0.0085 -0.0084 -0.0084 -0.0004 -0.0021 0.0993 -63 -0.0049 -0.0012 -0.0033 -0.0065 -0.0005 -0.0087 -0.0015 0.0993 -0.0094 -0.0075 -0.0030 -0.0048 -0.0026 -0.0036 -0.0138 -0.0085 -0.0084 -0.0084 -0.0004 -0.0021 0.0993 -116 -0.0049 -0.0012 -0.0033 -0.0065 -0.0005 -0.0087 -0.0015 0.0993 -0.0094 -0.0075 -0.0030 -0.0048 -0.0026 -0.0036 -0.0138 -0.0085 -0.0084 -0.0084 -0.0004 -0.0021 0.0993 -67 -0.0064 -0.0013 -0.0034 -0.0069 -0.0006 -0.0090 -0.0016 -0.0058 -0.0091 -0.0075 -0.0037 -0.0049 -0.0027 -0.0037 -0.0135 -0.0086 -0.0070 0.0985 -0.0005 -0.0022 0.0985 -29 -0.0064 -0.0013 -0.0037 -0.0066 -0.0008 -0.0089 -0.0016 -0.0087 -0.0091 -0.0073 -0.0011 -0.0049 -0.0026 -0.0037 -0.0136 -0.0086 -0.0070 0.0984 -0.0004 -0.0022 0.0984 -57 -0.0049 -0.0012 -0.0033 -0.0065 -0.0007 -0.0086 -0.0015 0.0970 -0.0090 -0.0073 -0.0012 -0.0051 -0.0025 -0.0036 -0.0135 -0.0088 -0.0084 -0.0084 -0.0003 -0.0021 0.0970 -41 -0.0049 -0.0012 -0.0033 -0.0065 -0.0007 -0.0086 -0.0015 0.0970 -0.0090 -0.0073 -0.0012 -0.0051 -0.0025 -0.0036 -0.0135 -0.0088 -0.0084 -0.0084 -0.0003 -0.0021 0.0970 -36 -0.0049 -0.0012 -0.0033 -0.0065 -0.0007 -0.0086 -0.0015 0.0970 -0.0090 -0.0073 -0.0012 -0.0051 -0.0025 -0.0036 -0.0135 -0.0088 -0.0084 -0.0084 -0.0003 -0.0021 0.0970 -33 -0.0049 -0.0012 -0.0033 -0.0065 -0.0007 -0.0086 -0.0015 0.0970 -0.0090 -0.0073 -0.0012 -0.0051 -0.0025 -0.0036 -0.0135 -0.0088 -0.0084 -0.0084 -0.0003 -0.0021 0.0970 -119 -0.0049 -0.0012 -0.0033 -0.0065 -0.0007 -0.0086 -0.0015 0.0970 -0.0090 -0.0073 -0.0012 -0.0051 -0.0025 -0.0036 -0.0135 -0.0088 -0.0084 -0.0084 -0.0003 -0.0021 0.0970 -25 -0.0049 -0.0012 -0.0033 -0.0065 -0.0007 -0.0086 -0.0015 0.0970 -0.0090 -0.0073 -0.0012 -0.0051 -0.0025 -0.0036 -0.0135 -0.0088 -0.0084 -0.0084 -0.0003 -0.0021 0.0970 -64 -0.0050 -0.0012 -0.0036 0.0967 -0.0005 -0.0109 -0.0015 -0.0056 -0.0120 -0.0070 -0.0010 -0.0048 -0.0025 -0.0037 -0.0134 -0.0084 -0.0068 -0.0063 -0.0003 -0.0021 0.0967 -81 -0.0050 -0.0012 -0.0036 0.0967 -0.0005 -0.0109 -0.0015 -0.0056 -0.0120 -0.0070 -0.0010 -0.0048 -0.0025 -0.0037 -0.0134 -0.0084 -0.0068 -0.0063 -0.0003 -0.0021 0.0967 -80 -0.0050 -0.0012 -0.0036 0.0967 -0.0005 -0.0109 -0.0015 -0.0056 -0.0120 -0.0070 -0.0010 -0.0048 -0.0025 -0.0037 -0.0134 -0.0084 -0.0068 -0.0063 -0.0003 -0.0021 0.0967 -115 -0.0050 -0.0012 -0.0036 0.0967 -0.0005 -0.0109 -0.0015 -0.0056 -0.0120 -0.0070 -0.0010 -0.0048 -0.0025 -0.0037 -0.0134 -0.0084 -0.0068 -0.0063 -0.0003 -0.0021 0.0967 -114 -0.0050 -0.0012 -0.0036 0.0967 -0.0005 -0.0109 -0.0015 -0.0056 -0.0120 -0.0070 -0.0010 -0.0048 -0.0025 -0.0037 -0.0134 -0.0084 -0.0068 -0.0063 -0.0003 -0.0021 0.0967 -11 -0.0050 -0.0012 -0.0036 0.0967 -0.0005 -0.0109 -0.0015 -0.0056 -0.0120 -0.0070 -0.0010 -0.0048 -0.0025 -0.0037 -0.0134 -0.0084 -0.0068 -0.0063 -0.0003 -0.0021 0.0967 -107 -0.0050 -0.0012 -0.0036 0.0967 -0.0005 -0.0109 -0.0015 -0.0056 -0.0120 -0.0070 -0.0010 -0.0048 -0.0025 -0.0037 -0.0134 -0.0084 -0.0068 -0.0063 -0.0003 -0.0021 0.0967 -46 -0.0050 -0.0012 -0.0036 0.0967 -0.0005 -0.0109 -0.0015 -0.0056 -0.0120 -0.0070 -0.0010 -0.0048 -0.0025 -0.0037 -0.0134 -0.0084 -0.0068 -0.0063 -0.0003 -0.0021 0.0967 -53 -0.0050 -0.0012 -0.0036 0.0967 -0.0005 -0.0109 -0.0015 -0.0056 -0.0120 -0.0070 -0.0010 -0.0048 -0.0025 -0.0037 -0.0134 -0.0084 -0.0068 -0.0063 -0.0003 -0.0021 0.0967 -14 -0.0050 -0.0012 -0.0036 0.0967 -0.0005 -0.0109 -0.0015 -0.0056 -0.0120 -0.0070 -0.0010 -0.0048 -0.0025 -0.0037 -0.0134 -0.0084 -0.0068 -0.0063 -0.0003 -0.0021 0.0967 -24 -0.0050 -0.0012 -0.0036 0.0967 -0.0005 -0.0109 -0.0015 -0.0056 -0.0120 -0.0070 -0.0010 -0.0048 -0.0025 -0.0037 -0.0134 -0.0084 -0.0068 -0.0063 -0.0003 -0.0021 0.0967 -73 -0.0050 -0.0012 -0.0036 0.0967 -0.0005 -0.0109 -0.0015 -0.0056 -0.0120 -0.0070 -0.0010 -0.0048 -0.0025 -0.0037 -0.0134 -0.0084 -0.0068 -0.0063 -0.0003 -0.0021 0.0967 -130 -0.0070 -0.0011 -0.0032 -0.0064 -0.0005 -0.0084 -0.0014 -0.0065 -0.0091 -0.0069 -0.0016 -0.0047 -0.0026 -0.0035 -0.0135 -0.0085 0.0933 -0.0060 -0.0003 -0.0020 0.0933 -45 -0.0070 -0.0011 -0.0032 -0.0064 -0.0004 -0.0084 -0.0014 -0.0072 -0.0088 -0.0069 -0.0009 -0.0050 -0.0026 -0.0035 -0.0132 -0.0088 0.0932 -0.0060 -0.0003 -0.0020 0.0932 -92 -0.0070 -0.0011 -0.0032 -0.0064 -0.0004 -0.0084 -0.0014 -0.0072 -0.0088 -0.0069 -0.0009 -0.0050 -0.0026 -0.0035 -0.0132 -0.0088 0.0932 -0.0060 -0.0003 -0.0020 0.0932 -23 -0.0070 -0.0011 -0.0032 -0.0064 -0.0004 -0.0084 -0.0014 -0.0072 -0.0088 -0.0069 -0.0009 -0.0050 -0.0026 -0.0035 -0.0132 -0.0088 0.0932 -0.0060 -0.0003 -0.0020 0.0932 -15 -0.0070 -0.0011 -0.0032 -0.0064 -0.0004 -0.0084 -0.0014 -0.0072 -0.0088 -0.0069 -0.0009 -0.0050 -0.0026 -0.0035 -0.0132 -0.0088 0.0932 -0.0060 -0.0003 -0.0020 0.0932 -6 -0.0070 -0.0011 -0.0032 -0.0064 -0.0004 -0.0084 -0.0014 -0.0072 -0.0088 -0.0069 -0.0009 -0.0050 -0.0026 -0.0035 -0.0132 -0.0088 0.0932 -0.0060 -0.0003 -0.0020 0.0932 -62 -0.0070 -0.0011 -0.0032 -0.0064 -0.0004 -0.0084 -0.0014 -0.0072 -0.0091 -0.0069 -0.0009 -0.0047 -0.0026 -0.0035 -0.0135 -0.0085 0.0932 -0.0060 -0.0003 -0.0020 0.0932 -52 -0.0046 -0.0030 -0.0032 -0.0063 -0.0001 -0.0086 0.0450 -0.0054 -0.0090 -0.0070 -0.0004 -0.0049 -0.0021 -0.0033 -0.0141 -0.0086 -0.0067 -0.0059 0.0003 0.0479 0.0931 -68 -0.0048 -0.0012 -0.0032 -0.0063 -0.0021 -0.0084 -0.0017 -0.0058 -0.0088 0.0924 -0.0009 -0.0047 -0.0040 -0.0035 -0.0135 -0.0083 -0.0067 -0.0062 -0.0003 -0.0020 0.0924 -108 -0.0048 -0.0012 -0.0032 -0.0063 -0.0021 -0.0084 -0.0017 -0.0058 -0.0088 0.0924 -0.0009 -0.0047 -0.0040 -0.0035 -0.0135 -0.0083 -0.0067 -0.0062 -0.0003 -0.0020 0.0924 -110 -0.0048 -0.0012 -0.0032 -0.0063 -0.0021 -0.0084 -0.0017 -0.0058 -0.0088 0.0924 -0.0009 -0.0047 -0.0040 -0.0035 -0.0135 -0.0083 -0.0067 -0.0062 -0.0003 -0.0020 0.0924 -49 -0.0048 -0.0012 -0.0032 -0.0063 -0.0021 -0.0084 -0.0017 -0.0058 -0.0088 0.0924 -0.0009 -0.0047 -0.0040 -0.0035 -0.0135 -0.0083 -0.0067 -0.0062 -0.0003 -0.0020 0.0924 -47 -0.0048 -0.0012 -0.0032 -0.0063 -0.0021 -0.0084 -0.0017 -0.0058 -0.0088 0.0924 -0.0009 -0.0047 -0.0040 -0.0035 -0.0135 -0.0083 -0.0067 -0.0062 -0.0003 -0.0020 0.0924 -101 -0.0028 0.0012 -0.0423 -0.0054 0.0019 0.0395 0.0006 -0.0032 -0.0065 -0.0046 0.0015 0.0436 -0.0001 -0.0011 -0.0108 -0.0062 -0.0044 -0.0041 0.0021 0.0013 0.0917 -60 -0.0047 -0.0013 -0.0031 -0.0062 -0.0004 -0.0106 -0.0014 -0.0056 -0.0086 -0.0068 -0.0009 -0.0075 -0.0024 -0.0034 -0.0138 0.0915 -0.0068 -0.0058 -0.0003 -0.0020 0.0915 -84 -0.0047 -0.0013 -0.0031 -0.0062 -0.0004 -0.0106 -0.0014 -0.0056 -0.0086 -0.0068 -0.0009 -0.0075 -0.0024 -0.0034 -0.0138 0.0915 -0.0068 -0.0058 -0.0003 -0.0020 0.0915 -56 -0.0048 -0.0011 -0.0032 -0.0063 -0.0006 -0.0084 -0.0014 -0.0055 -0.0088 0.0906 -0.0012 -0.0047 -0.0035 -0.0037 -0.0134 -0.0088 -0.0067 -0.0062 -0.0004 -0.0020 0.0906 -79 -0.0048 -0.0011 -0.0032 -0.0063 -0.0004 -0.0084 -0.0014 -0.0055 -0.0088 0.0906 -0.0012 -0.0047 -0.0040 -0.0038 -0.0135 -0.0083 -0.0067 -0.0062 -0.0003 -0.0020 0.0906 -127 -0.0048 -0.0009 0.0150 0.0748 -0.0002 -0.0115 -0.0013 -0.0053 -0.0094 -0.0068 -0.0006 -0.0076 -0.0022 -0.0033 -0.0132 -0.0082 -0.0066 -0.0060 0.0000 -0.0020 0.0898 -9 -0.0049 -0.0014 -0.0031 -0.0062 -0.0022 -0.0082 -0.0014 -0.0054 -0.0086 -0.0068 -0.0009 -0.0046 -0.0040 -0.0034 -0.0129 0.0894 -0.0069 -0.0059 -0.0003 -0.0023 0.0894 -69 -0.0049 -0.0014 -0.0031 -0.0062 -0.0022 -0.0082 -0.0014 -0.0054 -0.0086 -0.0068 -0.0009 -0.0046 -0.0040 -0.0034 -0.0129 0.0894 -0.0069 -0.0059 -0.0003 -0.0023 0.0894 -3 -0.0049 -0.0014 -0.0031 -0.0062 -0.0022 -0.0082 -0.0014 -0.0054 -0.0086 -0.0068 -0.0009 -0.0046 -0.0040 -0.0034 -0.0129 0.0894 -0.0069 -0.0059 -0.0003 -0.0023 0.0894 -28 -0.0049 -0.0014 -0.0031 -0.0062 -0.0022 -0.0082 -0.0014 -0.0054 -0.0086 -0.0068 -0.0009 -0.0046 -0.0040 -0.0034 -0.0129 0.0894 -0.0069 -0.0059 -0.0003 -0.0023 0.0894 -5 -0.0047 -0.0012 -0.0060 -0.0061 -0.0003 0.0893 -0.0013 -0.0053 -0.0085 -0.0067 -0.0008 -0.0045 -0.0023 -0.0033 -0.0130 -0.0111 -0.0065 -0.0059 -0.0002 -0.0019 0.0893 -126 -0.0047 -0.0012 -0.0060 -0.0061 -0.0003 0.0893 -0.0013 -0.0053 -0.0085 -0.0067 -0.0008 -0.0044 -0.0023 -0.0033 -0.0130 -0.0111 -0.0065 -0.0059 -0.0002 -0.0019 0.0893 -86 -0.0047 -0.0010 -0.0030 -0.0091 -0.0003 0.0893 -0.0013 -0.0053 -0.0085 -0.0067 -0.0007 -0.0044 -0.0023 -0.0032 -0.0164 -0.0080 -0.0065 -0.0059 -0.0003 -0.0018 0.0893 -17 -0.0047 -0.0010 -0.0030 -0.0091 -0.0003 0.0893 -0.0013 -0.0053 -0.0085 -0.0067 -0.0007 -0.0044 -0.0023 -0.0032 -0.0164 -0.0080 -0.0065 -0.0059 -0.0003 -0.0018 0.0893 -54 -0.0047 -0.0010 -0.0030 -0.0091 -0.0003 0.0892 -0.0013 -0.0053 -0.0085 -0.0067 -0.0007 -0.0044 -0.0023 -0.0032 -0.0164 -0.0080 -0.0065 -0.0059 -0.0002 -0.0018 0.0892 -30 -0.0047 -0.0010 -0.0030 -0.0091 -0.0003 0.0892 -0.0013 -0.0053 -0.0085 -0.0067 -0.0007 -0.0044 -0.0023 -0.0032 -0.0164 -0.0080 -0.0065 -0.0059 -0.0002 -0.0018 0.0892 -37 -0.0047 -0.0010 -0.0030 -0.0091 -0.0003 0.0891 -0.0013 -0.0053 -0.0085 -0.0067 -0.0007 -0.0044 -0.0023 -0.0032 -0.0164 -0.0080 -0.0065 -0.0059 -0.0002 -0.0018 0.0891 -94 -0.0047 -0.0010 -0.0030 -0.0091 -0.0003 0.0891 -0.0013 -0.0053 -0.0085 -0.0067 -0.0007 -0.0044 -0.0023 -0.0032 -0.0164 -0.0080 -0.0065 -0.0059 -0.0002 -0.0018 0.0891 -93 -0.0047 -0.0010 -0.0030 -0.0091 -0.0003 0.0891 -0.0013 -0.0053 -0.0085 -0.0067 -0.0007 -0.0044 -0.0023 -0.0032 -0.0164 -0.0080 -0.0065 -0.0059 -0.0001 -0.0018 0.0891 -35 -0.0047 -0.0010 -0.0030 -0.0091 -0.0003 0.0891 -0.0013 -0.0053 -0.0085 -0.0067 -0.0007 -0.0044 -0.0023 -0.0032 -0.0164 -0.0080 -0.0065 -0.0059 -0.0001 -0.0018 0.0891 -105 -0.0045 -0.0005 -0.0027 -0.0061 0.0002 -0.0083 -0.0008 -0.0087 -0.0090 -0.0071 0.0492 -0.0043 -0.0019 -0.0030 -0.0136 -0.0081 -0.0080 0.0384 0.0004 -0.0015 0.0881 -87 -0.0045 -0.0010 -0.0030 -0.0084 -0.0003 -0.0081 -0.0013 -0.0054 0.0876 -0.0066 -0.0008 -0.0048 -0.0023 -0.0034 -0.0153 -0.0080 -0.0066 -0.0057 -0.0002 -0.0019 0.0876 -90 -0.0045 -0.0010 -0.0030 -0.0084 -0.0003 -0.0081 -0.0013 -0.0053 0.0876 -0.0066 -0.0009 -0.0048 -0.0023 -0.0034 -0.0153 -0.0080 -0.0066 -0.0057 -0.0002 -0.0018 0.0876 -48 -0.0045 -0.0010 -0.0030 -0.0084 -0.0003 -0.0081 -0.0013 -0.0055 0.0876 -0.0066 -0.0008 -0.0048 -0.0023 -0.0034 -0.0153 -0.0080 -0.0066 -0.0057 -0.0002 -0.0018 0.0876 -91 -0.0045 -0.0010 -0.0030 -0.0084 -0.0003 -0.0081 -0.0013 -0.0055 0.0876 -0.0066 -0.0008 -0.0048 -0.0023 -0.0034 -0.0153 -0.0080 -0.0066 -0.0057 -0.0002 -0.0018 0.0876 -7 -0.0045 -0.0010 -0.0030 -0.0084 -0.0003 -0.0081 -0.0013 -0.0055 0.0876 -0.0066 -0.0008 -0.0048 -0.0023 -0.0034 -0.0153 -0.0080 -0.0066 -0.0057 -0.0002 -0.0018 0.0876 -113 -0.0045 -0.0010 -0.0030 -0.0084 -0.0003 -0.0081 -0.0013 -0.0055 0.0876 -0.0066 -0.0008 -0.0048 -0.0023 -0.0034 -0.0153 -0.0080 -0.0066 -0.0057 -0.0002 -0.0018 0.0876 -18 -0.0046 -0.0006 0.0444 0.0409 0.0001 -0.0110 -0.0009 -0.0052 -0.0116 -0.0066 -0.0004 -0.0049 -0.0020 -0.0032 -0.0131 -0.0080 -0.0064 -0.0058 0.0003 -0.0016 0.0857 -76 -0.0043 -0.0006 -0.0054 -0.0059 0.0002 -0.0080 -0.0010 -0.0053 -0.0090 -0.0064 -0.0003 0.0437 -0.0019 -0.0029 -0.0128 -0.0107 0.0375 -0.0055 0.0003 -0.0017 0.0817 -100 -0.0060 -0.0007 -0.0028 -0.0063 0.0000 -0.0084 -0.0010 0.0367 -0.0085 -0.0070 -0.0006 -0.0043 -0.0020 -0.0030 -0.0130 -0.0079 -0.0065 0.0424 0.0002 -0.0016 0.0793 -109 -0.0056 -0.0007 -0.0030 -0.0060 -0.0002 -0.0083 -0.0010 0.0375 -0.0084 -0.0067 -0.0005 -0.0044 -0.0020 -0.0030 -0.0129 -0.0080 -0.0068 0.0414 0.0002 -0.0016 0.0792 -50 -0.0043 -0.0009 -0.0032 -0.0059 0.0000 -0.0104 -0.0010 -0.0053 -0.0085 -0.0065 -0.0004 0.0389 -0.0020 -0.0030 -0.0137 0.0397 -0.0065 -0.0055 0.0002 -0.0016 0.0788 -61 -0.0043 -0.0006 -0.0027 -0.0059 -0.0003 -0.0080 -0.0009 0.0385 -0.0084 0.0387 -0.0006 -0.0042 -0.0020 -0.0030 -0.0128 -0.0096 -0.0064 -0.0059 0.0001 -0.0015 0.0774 -117 -0.0042 -0.0008 -0.0027 -0.0056 -0.0001 -0.0099 -0.0011 -0.0049 -0.0111 -0.0061 -0.0007 -0.0041 -0.0020 -0.0029 0.0771 -0.0078 -0.0061 -0.0053 -0.0002 -0.0016 0.0771 -75 -0.0042 -0.0008 -0.0027 -0.0056 -0.0001 -0.0099 -0.0011 -0.0049 -0.0111 -0.0061 -0.0007 -0.0041 -0.0020 -0.0029 0.0771 -0.0078 -0.0061 -0.0053 -0.0002 -0.0016 0.0771 -106 -0.0042 -0.0008 -0.0027 -0.0056 -0.0001 -0.0099 -0.0011 -0.0049 -0.0111 -0.0061 -0.0007 -0.0041 -0.0020 -0.0029 0.0771 -0.0078 -0.0061 -0.0053 -0.0001 -0.0016 0.0771 -74 -0.0042 -0.0008 -0.0027 -0.0056 -0.0001 -0.0099 -0.0011 -0.0049 -0.0111 -0.0061 -0.0007 -0.0041 -0.0020 -0.0029 0.0770 -0.0078 -0.0061 -0.0053 -0.0001 -0.0016 0.0770 -26 -0.0042 -0.0008 -0.0027 -0.0056 -0.0001 -0.0099 -0.0011 -0.0050 -0.0111 -0.0061 -0.0006 -0.0041 -0.0020 -0.0029 0.0770 -0.0078 -0.0061 -0.0053 -0.0001 -0.0016 0.0770 -99 -0.0042 -0.0008 -0.0027 -0.0056 -0.0001 -0.0099 -0.0011 -0.0051 -0.0111 -0.0061 -0.0006 -0.0041 -0.0020 -0.0029 0.0769 -0.0078 -0.0061 -0.0053 0.0000 -0.0016 0.0769 -19 -0.0042 -0.0025 -0.0027 -0.0056 -0.0002 -0.0078 -0.0041 -0.0049 -0.0079 -0.0064 -0.0006 -0.0041 -0.0022 -0.0030 0.0768 -0.0078 -0.0060 -0.0053 -0.0000 -0.0016 0.0768 -121 -0.0042 -0.0025 -0.0027 -0.0056 -0.0002 -0.0078 -0.0041 -0.0049 -0.0079 -0.0064 -0.0006 -0.0041 -0.0022 -0.0030 0.0768 -0.0078 -0.0060 -0.0053 -0.0000 -0.0016 0.0768 -8 -0.0042 -0.0008 -0.0027 -0.0056 -0.0002 -0.0078 -0.0011 -0.0049 -0.0079 -0.0064 -0.0006 -0.0041 -0.0022 -0.0060 0.0764 -0.0074 -0.0060 -0.0053 -0.0017 -0.0016 0.0764 -34 -0.0049 -0.0011 0.0411 -0.0066 -0.0003 0.0030 -0.0014 -0.0054 -0.0087 -0.0068 -0.0007 -0.0065 -0.0023 -0.0033 -0.0134 0.0323 -0.0067 -0.0061 -0.0001 -0.0020 0.0763 -55 -0.0042 -0.0009 -0.0027 -0.0056 -0.0002 -0.0078 -0.0011 -0.0049 -0.0079 -0.0064 -0.0006 -0.0041 -0.0022 -0.0059 0.0762 -0.0074 -0.0060 -0.0053 -0.0014 -0.0016 0.0762 -38 -0.0042 -0.0008 -0.0027 -0.0056 -0.0002 -0.0081 -0.0011 -0.0049 -0.0084 -0.0063 -0.0006 -0.0041 -0.0022 -0.0055 0.0754 -0.0075 -0.0060 -0.0053 -0.0000 -0.0016 0.0754 -118 -0.0042 -0.0008 -0.0027 -0.0056 -0.0002 -0.0079 -0.0011 -0.0049 -0.0081 -0.0064 -0.0006 -0.0041 -0.0022 -0.0059 0.0753 -0.0075 -0.0060 -0.0053 -0.0002 -0.0016 0.0753 -103 -0.0045 -0.0010 -0.0030 -0.0082 -0.0003 -0.0084 -0.0013 -0.0053 0.0707 -0.0066 -0.0009 -0.0047 -0.0023 -0.0034 0.0017 -0.0080 -0.0066 -0.0057 -0.0002 -0.0019 0.0724 -77 -0.0045 -0.0010 -0.0030 -0.0079 -0.0003 -0.0088 -0.0013 -0.0055 0.0700 -0.0066 -0.0008 -0.0047 -0.0023 -0.0034 0.0023 -0.0080 -0.0066 -0.0057 -0.0002 -0.0019 0.0723 -98 -0.0043 -0.0009 -0.0028 -0.0078 -0.0002 -0.0085 -0.0011 -0.0050 0.0059 -0.0063 -0.0009 -0.0045 -0.0021 -0.0032 0.0626 -0.0077 -0.0063 -0.0054 -0.0001 -0.0017 0.0685 -31 -0.0042 -0.0008 -0.0028 -0.0085 -0.0002 -0.0080 -0.0011 -0.0051 0.0085 -0.0063 -0.0007 -0.0046 -0.0021 -0.0032 0.0600 -0.0076 -0.0063 -0.0054 -0.0000 -0.0017 0.0685 -102 -0.0044 -0.0008 -0.0027 -0.0094 -0.0001 0.0393 -0.0010 -0.0050 -0.0081 -0.0063 -0.0005 -0.0041 -0.0020 -0.0030 0.0290 -0.0076 -0.0061 -0.0056 0.0000 -0.0016 0.0683 -65 -0.0042 -0.0008 -0.0027 -0.0063 -0.0001 -0.0100 -0.0011 -0.0052 0.0344 -0.0063 -0.0006 -0.0042 -0.0020 -0.0030 0.0333 -0.0079 -0.0063 -0.0054 0.0000 -0.0016 0.0677 \ No newline at end of file diff --git a/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_loglikelihood.txt b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_loglikelihood.txt new file mode 100644 index 00000000..445faf48 --- /dev/null +++ b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_loglikelihood.txt @@ -0,0 +1 @@ +log likelihood = -1104.88 \ No newline at end of file diff --git a/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_modelparams.txt b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_modelparams.txt new file mode 100644 index 00000000..89627d33 --- /dev/null +++ b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_modelparams.txt @@ -0,0 +1,7 @@ +alpha_omega = 0.300001 +beta = 0.279772 +beta_omega = 2.49082 +kappa = 8.97128 +phiA = 0.349149 +phiC = 0.174724 +phiG = 0.269946 \ No newline at end of file diff --git a/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_omegabycategory.csv b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_omegabycategory.csv new file mode 100644 index 00000000..e7d534dc --- /dev/null +++ b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_omegabycategory.csv @@ -0,0 +1,261 @@ +site,omega,post_probability +1,0.006611789278139513,0.5384019947709547 +2,0.006611789278139513,0.49099836930439644 +3,0.006611789278139513,0.5973825536777461 +4,0.006611789278139513,0.4931780677388738 +5,0.006611789278139513,0.5051160320564196 +6,0.006611789278139513,0.49819079591578785 +7,0.006611789278139513,0.5014300992991303 +8,0.006611789278139513,0.5873315410270414 +9,0.006611789278139513,0.4974162036818532 +10,0.006611789278139513,0.701493427659119 +11,0.006611789278139513,0.5048338749984084 +12,0.006611789278139513,0.4858690991679025 +13,0.006611789278139513,0.5384019947709547 +14,0.006611789278139513,0.6985652261665715 +15,0.006611789278139513,0.5010966782032248 +16,0.006611789278139513,0.5164785691363653 +17,0.006611789278139513,0.5988077805412187 +18,0.006611789278139513,0.04220137777571227 +19,0.006611789278139513,0.4999019173637469 +20,0.006611789278139513,0.4858690991679025 +21,0.006611789278139513,0.5116101770230349 +22,0.006611789278139513,0.6023466785857603 +23,0.006611789278139513,0.5010966782032248 +24,0.006611789278139513,0.6979855299639087 +25,0.006611789278139513,0.6037622946364786 +26,0.006611789278139513,0.6017405715073637 +27,0.006611789278139513,0.498311502597559 +28,0.006611789278139513,0.5973825536777461 +29,0.006611789278139513,0.6032026466544711 +30,0.006611789278139513,0.6014799928760168 +31,0.006611789278139513,0.0027339773991652823 +32,0.006611789278139513,0.5384019947709547 +33,0.006611789278139513,0.5036374432847732 +34,0.006611789278139513,0.0019159239912096072 +35,0.006611789278139513,0.5021508138340861 +36,0.006611789278139513,0.5036374432847732 +37,0.006611789278139513,0.6964704348109668 +38,0.006611789278139513,0.5895389932057374 +39,0.006611789278139513,0.5046161426670468 +40,0.006611789278139513,0.503732308138872 +41,0.006611789278139513,0.5007321163008979 +42,0.006611789278139513,0.4931780677388738 +43,0.006611789278139513,0.5384019947709547 +44,0.006611789278139513,0.610151659053204 +45,0.006611789278139513,0.7024977190919531 +46,0.006611789278139513,0.6073135838875542 +47,0.006611789278139513,0.6942288522450716 +48,0.006611789278139513,0.6042464373163501 +49,0.006611789278139513,0.5971495355217108 +50,0.006611789278139513,0.04328120112619658 +51,0.006611789278139513,0.5164785691363653 +52,0.006611789278139513,0.042117053003421424 +53,0.006611789278139513,0.601781332518019 +54,0.006611789278139513,0.6014799928760168 +55,0.006611789278139513,0.884723779443939 +56,0.006611789278139513,0.6628519256052029 +57,0.006611789278139513,0.5007321163008979 +58,0.006611789278139513,0.5893505767301253 +59,0.006611789278139513,0.5087066409725199 +60,0.006611789278139513,0.5124480044408564 +61,0.006611789278139513,0.05485708828892639 +62,0.006611789278139513,0.4950936944340624 +63,0.006611789278139513,0.5288620081651401 +64,0.006611789278139513,0.4975217242990691 +65,0.006611789278139513,0.061284386496638844 +66,0.006611789278139513,0.5384019947709547 +67,0.006611789278139513,0.5929673488615056 +68,0.006611789278139513,0.4944241889206179 +69,0.006611789278139513,0.4974162036818532 +70,0.006611789278139513,0.5043200156169201 +71,0.006611789278139513,0.5075204499984264 +72,0.006611789278139513,0.7089095543985896 +73,0.006611789278139513,0.7761948941188939 +74,0.006611789278139513,0.6004442622040502 +75,0.006611789278139513,0.5981981436698873 +76,0.006611789278139513,0.04278976351253414 +77,0.006611789278139513,0.0018330370087555174 +78,0.006611789278139513,0.7019148324642936 +79,0.006611789278139513,0.45733563255259907 +80,0.006611789278139513,0.5048338749984084 +81,0.006611789278139513,0.5048338749984084 +82,0.006611789278139513,0.6123472462767818 +83,0.006611789278139513,0.49917170929633614 +84,0.006611789278139513,0.7077740677598144 +85,0.006611789278139513,0.7745672722569793 +86,0.006611789278139513,0.4956880920010061 +87,0.006611789278139513,0.7006721161310486 +88,0.006611789278139513,0.6180115484946023 +89,0.006611789278139513,0.6041276263225304 +90,0.006611789278139513,0.49410354114789484 +91,0.006611789278139513,0.5014300992991303 +92,0.006611789278139513,0.5010966782032248 +93,0.006611789278139513,0.6038936082499351 +94,0.006611789278139513,0.6971762779188149 +95,0.006611789278139513,0.601895697313776 +96,0.006611789278139513,0.5288620081651401 +97,0.006611789278139513,0.503732308138872 +98,0.006611789278139513,0.002591792165007417 +99,0.006611789278139513,0.5014346905291717 +100,0.006611789278139513,0.06085025087558882 +101,0.006611789278139513,5.366055049567949e-06 +102,0.006611789278139513,0.08995340791702623 +103,0.006611789278139513,0.0027362542364604927 +104,0.006611789278139513,0.5143834523976565 +105,0.006611789278139513,0.046672480646704734 +106,0.006611789278139513,0.6199264784707942 +107,0.006611789278139513,0.5048338749984084 +108,0.006611789278139513,0.4944241889206179 +109,0.006611789278139513,0.04083740093370843 +110,0.006611789278139513,0.49732986692861475 +111,0.006611789278139513,0.6088249329926151 +112,0.006611789278139513,0.5135764579467412 +113,0.006611789278139513,0.5014300992991303 +114,0.006611789278139513,0.5048338749984084 +115,0.006611789278139513,0.5048338749984084 +116,0.006611789278139513,0.5288620081651401 +117,0.006611789278139513,0.49494456781025276 +118,0.006611789278139513,0.6836666323663484 +119,0.006611789278139513,0.6033879676301398 +120,0.006611789278139513,0.5143834523976565 +121,0.006611789278139513,0.4999019173637469 +122,0.006611789278139513,0.4931780677388738 +123,0.006611789278139513,0.6994335376477115 +124,0.006611789278139513,0.7058856682083111 +125,0.006611789278139513,0.5116101770230349 +126,0.006611789278139513,0.6106344693272531 +127,0.006611789278139513,0.0029228089363347097 +128,0.006611789278139513,0.5164785691363653 +129,0.006611789278139513,0.7798885115200944 +130,0.006611789278139513,0.6903286932085246 +1,0.23427399456894704,0.4615980052290452 +2,0.23427399456894704,0.5090016306956034 +3,0.23427399456894704,0.40261744632225394 +4,0.23427399456894704,0.5068219322611263 +5,0.23427399456894704,0.49488396794358047 +6,0.23427399456894704,0.501809204084212 +7,0.23427399456894704,0.49856990070086976 +8,0.23427399456894704,0.4126684589729586 +9,0.23427399456894704,0.5025837963181469 +10,0.23427399456894704,0.298506572340881 +11,0.23427399456894704,0.4951661250015917 +12,0.23427399456894704,0.5141309008320974 +13,0.23427399456894704,0.4615980052290452 +14,0.23427399456894704,0.3014347738334284 +15,0.23427399456894704,0.4989033217967753 +16,0.23427399456894704,0.48352143086363475 +17,0.23427399456894704,0.40119221945878125 +18,0.23427399456894704,0.9577986222242878 +19,0.23427399456894704,0.5000980826362531 +20,0.23427399456894704,0.5141309008320974 +21,0.23427399456894704,0.48838982297696504 +22,0.23427399456894704,0.39765332141423976 +23,0.23427399456894704,0.4989033217967753 +24,0.23427399456894704,0.3020144700360913 +25,0.23427399456894704,0.3962377053635215 +26,0.23427399456894704,0.39825942849263635 +27,0.23427399456894704,0.5016884974024409 +28,0.23427399456894704,0.40261744632225394 +29,0.23427399456894704,0.39679735334552885 +30,0.23427399456894704,0.39852000712398317 +31,0.23427399456894704,0.9972660226008346 +32,0.23427399456894704,0.4615980052290452 +33,0.23427399456894704,0.4963625567152267 +34,0.23427399456894704,0.9980840760087903 +35,0.23427399456894704,0.49784918616591384 +36,0.23427399456894704,0.4963625567152267 +37,0.23427399456894704,0.30352956518903307 +38,0.23427399456894704,0.4104610067942625 +39,0.23427399456894704,0.4953838573329533 +40,0.23427399456894704,0.4962676918611278 +41,0.23427399456894704,0.499267883699102 +42,0.23427399456894704,0.5068219322611263 +43,0.23427399456894704,0.4615980052290452 +44,0.23427399456894704,0.389848340946796 +45,0.23427399456894704,0.29750228090804676 +46,0.23427399456894704,0.39268641611244576 +47,0.23427399456894704,0.3057711477549284 +48,0.23427399456894704,0.39575356268365 +49,0.23427399456894704,0.4028504644782891 +50,0.23427399456894704,0.9567187988738034 +51,0.23427399456894704,0.48352143086363475 +52,0.23427399456894704,0.9578829469965785 +53,0.23427399456894704,0.3982186674819809 +54,0.23427399456894704,0.39852000712398317 +55,0.23427399456894704,0.11527622055606114 +56,0.23427399456894704,0.33714807439479716 +57,0.23427399456894704,0.499267883699102 +58,0.23427399456894704,0.4106494232698747 +59,0.23427399456894704,0.49129335902748 +60,0.23427399456894704,0.4875519955591436 +61,0.23427399456894704,0.9451429117110737 +62,0.23427399456894704,0.5049063055659376 +63,0.23427399456894704,0.47113799183485994 +64,0.23427399456894704,0.502478275700931 +65,0.23427399456894704,0.9387156135033611 +66,0.23427399456894704,0.4615980052290452 +67,0.23427399456894704,0.40703265113849446 +68,0.23427399456894704,0.5055758110793821 +69,0.23427399456894704,0.5025837963181469 +70,0.23427399456894704,0.4956799843830799 +71,0.23427399456894704,0.4924795500015736 +72,0.23427399456894704,0.2910904456014104 +73,0.23427399456894704,0.22380510588110608 +74,0.23427399456894704,0.3995557377959498 +75,0.23427399456894704,0.40180185633011267 +76,0.23427399456894704,0.9572102364874658 +77,0.23427399456894704,0.9981669629912444 +78,0.23427399456894704,0.29808516753570635 +79,0.23427399456894704,0.542664367447401 +80,0.23427399456894704,0.4951661250015917 +81,0.23427399456894704,0.4951661250015917 +82,0.23427399456894704,0.38765275372321817 +83,0.23427399456894704,0.5008282907036639 +84,0.23427399456894704,0.2922259322401856 +85,0.23427399456894704,0.22543272774302073 +86,0.23427399456894704,0.504311907998994 +87,0.23427399456894704,0.2993278838689513 +88,0.23427399456894704,0.38198845150539784 +89,0.23427399456894704,0.39587237367746975 +90,0.23427399456894704,0.5058964588521052 +91,0.23427399456894704,0.49856990070086976 +92,0.23427399456894704,0.4989033217967753 +93,0.23427399456894704,0.39610639175006496 +94,0.23427399456894704,0.3028237220811852 +95,0.23427399456894704,0.398104302686224 +96,0.23427399456894704,0.47113799183485994 +97,0.23427399456894704,0.4962676918611278 +98,0.23427399456894704,0.9974082078349925 +99,0.23427399456894704,0.49856530947082844 +100,0.23427399456894704,0.9391497491244113 +101,0.23427399456894704,0.9999946339449505 +102,0.23427399456894704,0.9100465920829738 +103,0.23427399456894704,0.9972637457635395 +104,0.23427399456894704,0.48561654760234363 +105,0.23427399456894704,0.9533275193532953 +106,0.23427399456894704,0.38007352152920587 +107,0.23427399456894704,0.4951661250015917 +108,0.23427399456894704,0.5055758110793821 +109,0.23427399456894704,0.9591625990662915 +110,0.23427399456894704,0.5026701330713852 +111,0.23427399456894704,0.39117506700738497 +112,0.23427399456894704,0.4864235420532587 +113,0.23427399456894704,0.49856990070086976 +114,0.23427399456894704,0.4951661250015917 +115,0.23427399456894704,0.4951661250015917 +116,0.23427399456894704,0.47113799183485994 +117,0.23427399456894704,0.5050554321897474 +118,0.23427399456894704,0.3163333676336515 +119,0.23427399456894704,0.39661203236986026 +120,0.23427399456894704,0.48561654760234363 +121,0.23427399456894704,0.5000980826362531 +122,0.23427399456894704,0.5068219322611263 +123,0.23427399456894704,0.3005664623522885 +124,0.23427399456894704,0.29411433179168883 +125,0.23427399456894704,0.48838982297696504 +126,0.23427399456894704,0.3893655306727469 +127,0.23427399456894704,0.9970771910636653 +128,0.23427399456894704,0.48352143086363475 +129,0.23427399456894704,0.22011148847990553 +130,0.23427399456894704,0.30967130679147536 diff --git a/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_omegabysite.txt b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_omegabysite.txt new file mode 100644 index 00000000..1109512f --- /dev/null +++ b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_omegabysite.txt @@ -0,0 +1,136 @@ +# Omega fit to each site after fixing tree and all other parameters. +# Fits compared to null model of omega = 1. +# P-values NOT corrected for multiple testing, so consider Q-values too. +# Q-values computed separately for omega > and < 1 # Will fit different synonymous rate for each site. +# +site omega P dLnL Q +55 0.000 0.00133 5.148 0.173 +84 0.000 0.00993 3.324 0.196 +85 0.000 0.00768 3.553 0.196 +73 0.000 0.00652 3.700 0.196 +72 0.000 0.00915 3.397 0.196 +124 0.000 0.0106 3.268 0.196 +129 0.000 0.00417 4.104 0.196 +45 0.000 0.0185 2.776 0.218 +78 0.000 0.0148 2.968 0.218 +87 0.000 0.0184 2.781 0.218 +10 0.000 0.0155 2.929 0.218 +14 0.000 0.0224 2.607 0.22 +123 0.000 0.0218 2.633 0.22 +24 0.000 0.0237 2.560 0.22 +94 0.000 0.0256 2.491 0.221 +37 0.000 0.0272 2.439 0.221 +47 0.000 0.0337 2.254 0.258 +130 0.000 0.0416 2.075 0.301 +88 0.000 0.0612 1.752 0.419 +46 0.000 0.1 1.353 0.426 +44 0.000 0.0864 1.470 0.426 +93 0.000 0.115 1.242 0.426 +53 0.000 0.123 1.188 0.426 +54 0.000 0.124 1.180 0.426 +95 0.000 0.124 1.185 0.426 +106 0.000 0.0747 1.588 0.426 +89 0.000 0.113 1.257 0.426 +48 0.000 0.111 1.268 0.426 +111 0.000 0.0857 1.476 0.426 +82 0.000 0.0762 1.572 0.426 +29 0.000 0.118 1.223 0.426 +119 0.000 0.116 1.233 0.426 +30 0.000 0.124 1.180 0.426 +22 0.000 0.12 1.206 0.426 +118 0.000 0.0722 1.616 0.426 +26 0.000 0.123 1.188 0.426 +126 0.000 0.0886 1.449 0.426 +25 0.000 0.114 1.246 0.426 +74 0.000 0.128 1.156 0.428 +75 0.000 0.138 1.102 0.436 +17 0.000 0.134 1.121 0.436 +49 0.000 0.15 1.037 0.443 +3 0.000 0.149 1.041 0.443 +28 0.000 0.149 1.041 0.443 +67 0.000 0.16 0.986 0.459 +102 0.181 0.162 0.976 0.459 +38 0.000 0.194 0.843 0.507 +8 0.000 0.188 0.866 0.507 +56 0.000 0.183 0.885 0.507 +58 0.000 0.195 0.840 0.507 +127 0.453 0.552 0.177 1 +121 0.000 0.965 0.001 1 +125 0.000 0.963 0.001 1 +86 0.000 0.961 0.001 1 +120 0.999 0.999 0.000 1 +91 0.000 0.965 0.001 1 +92 0.000 0.966 0.001 1 +128 0.000 0.96 0.001 1 +122 0.000 0.971 0.001 1 +90 0.000 0.965 0.001 1 +117 0.000 0.963 0.001 1 +97 0.000 0.967 0.001 1 +110 0.000 0.969 0.001 1 +109 95.281 0.384 0.378 1 +108 0.000 0.969 0.001 1 +107 0.000 0.962 0.001 1 +112 0.000 0.96 0.001 1 +105 100.000 0.783 0.038 1 +83 0.000 0.966 0.001 1 +96 0.000 0.96 0.001 1 +103 0.954 0.97 0.001 1 +113 0.000 0.965 0.001 1 +114 0.000 0.962 0.001 1 +100 0.420 0.552 0.177 1 +99 0.000 0.963 0.001 1 +98 1.382 0.79 0.035 1 +115 0.000 0.962 0.001 1 +116 0.000 0.96 0.001 1 +101 0.949 0.964 0.001 1 +104 0.999 0.999 0.000 1 +1 0.000 0.957 0.001 1 +80 0.000 0.962 0.001 1 +34 100.000 0.329 0.476 1 +33 0.000 0.967 0.001 1 +32 0.000 0.957 0.001 1 +31 0.957 0.972 0.001 1 +27 0.000 0.964 0.001 1 +23 0.000 0.966 0.001 1 +21 0.000 0.963 0.001 1 +20 0.000 0.971 0.001 1 +19 0.000 0.965 0.001 1 +18 100.000 0.451 0.284 1 +16 0.000 0.96 0.001 1 +15 0.000 0.966 0.001 1 +13 0.000 0.957 0.001 1 +12 0.000 0.971 0.001 1 +11 0.000 0.962 0.001 1 +9 0.000 0.969 0.001 1 +7 0.000 0.965 0.001 1 +6 0.000 0.966 0.001 1 +5 0.000 0.962 0.001 1 +4 0.000 0.971 0.001 1 +2 0.000 0.964 0.001 1 +35 0.000 0.962 0.001 1 +81 0.000 0.962 0.001 1 +36 0.000 0.967 0.001 1 +40 0.000 0.967 0.001 1 +79 1.000 0.999 0.000 1 +77 100.000 0.234 0.708 1 +76 100.000 0.497 0.231 1 +71 0.000 0.966 0.001 1 +70 0.000 0.964 0.001 1 +69 0.000 0.969 0.001 1 +68 0.000 0.969 0.001 1 +66 0.000 0.957 0.001 1 +64 0.000 0.962 0.001 1 +63 0.000 0.96 0.001 1 +62 0.000 0.966 0.001 1 +61 1.428 0.805 0.030 1 +60 0.000 0.961 0.001 1 +59 0.000 0.963 0.001 1 +57 0.000 0.967 0.001 1 +52 100.000 0.466 0.266 1 +51 0.000 0.96 0.001 1 +50 100.000 0.518 0.209 1 +43 0.000 0.957 0.001 1 +42 0.000 0.971 0.001 1 +41 0.000 0.967 0.001 1 +39 0.000 0.966 0.001 1 +65 0.388 0.521 0.206 1 \ No newline at end of file diff --git a/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_posteriorprobabilities.csv b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_posteriorprobabilities.csv new file mode 100644 index 00000000..3dae5eb0 --- /dev/null +++ b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_posteriorprobabilities.csv @@ -0,0 +1,131 @@ +site,p(omega > 1) +1,0.0 +98,0.0 +96,0.0 +95,0.0 +94,0.0 +93,0.0 +92,0.0 +91,0.0 +90,0.0 +89,0.0 +88,0.0 +87,0.0 +86,0.0 +85,0.0 +84,0.0 +83,0.0 +82,0.0 +81,0.0 +80,0.0 +79,0.0 +78,0.0 +77,0.0 +76,0.0 +75,0.0 +74,0.0 +73,0.0 +72,0.0 +71,0.0 +70,0.0 +69,0.0 +68,0.0 +97,0.0 +99,0.0 +2,0.0 +100,0.0 +129,0.0 +128,0.0 +127,0.0 +126,0.0 +125,0.0 +124,0.0 +123,0.0 +122,0.0 +121,0.0 +120,0.0 +119,0.0 +118,0.0 +117,0.0 +116,0.0 +115,0.0 +114,0.0 +113,0.0 +112,0.0 +111,0.0 +110,0.0 +109,0.0 +108,0.0 +107,0.0 +106,0.0 +105,0.0 +104,0.0 +103,0.0 +102,0.0 +101,0.0 +67,0.0 +66,0.0 +65,0.0 +64,0.0 +31,0.0 +30,0.0 +29,0.0 +28,0.0 +27,0.0 +26,0.0 +25,0.0 +24,0.0 +23,0.0 +22,0.0 +21,0.0 +20,0.0 +19,0.0 +18,0.0 +17,0.0 +16,0.0 +15,0.0 +14,0.0 +13,0.0 +12,0.0 +11,0.0 +10,0.0 +9,0.0 +8,0.0 +7,0.0 +6,0.0 +5,0.0 +4,0.0 +3,0.0 +32,0.0 +33,0.0 +34,0.0 +50,0.0 +63,0.0 +62,0.0 +61,0.0 +60,0.0 +59,0.0 +58,0.0 +57,0.0 +56,0.0 +55,0.0 +54,0.0 +53,0.0 +52,0.0 +51,0.0 +49,0.0 +35,0.0 +48,0.0 +47,0.0 +46,0.0 +45,0.0 +44,0.0 +43,0.0 +42,0.0 +41,0.0 +40,0.0 +39,0.0 +38,0.0 +37,0.0 +36,0.0 +130,0.0 diff --git a/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_tree.newick b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_tree.newick new file mode 100644 index 00000000..c5f567cb --- /dev/null +++ b/tests/expected_NP_test_results/averaged_ExpCM_NP_prefs_short_gammaomega_tree.newick @@ -0,0 +1 @@ +(((((((((1984.68_15_A/DaNang/DN329/2008_HOST_Human_H1N1:0.03265,1980.70_58_A/Canterbury/106/2004_HOST_Human_H1N1:0.00001):0.01677,1976.54_75_A/Canterbury/9/2000_HOST_Human_H1N1:0.00761):0.06012,1956.50_150_A/Maryland/2/1980_HOST_Human_H1N1:0.00878):0.03345,((1918.50_2534_A/Brevig_Mission/1/1918_HOST_Human_H1N1:0.10637,1936.50_945_A/Henry/1936_HOST_Human_H1N1:0.09253):0.01213,1946.50_961_A/Cameron/1946_HOST_Human_H1N1:0.03349):0.01764):0.06134,1950.50_1400_A/Fort_Warren/1/1950_HOST_Human_H1N1:0.01713):0.00739,1960.50_597_A/Ann_Arbor/6/1960_HOST_Human_H2N2:0.00001):0.03356,1964.50_1934_A/Taiwan/1964_HOST_Human_H2N2:0.02518):0.00662,1968.50_273_A/Georgia/122/68_HOST_Human_H3N2:0.03477):0.01910,((1992.50_41_A/Beijing/32/1992_HOST_Human_H3N2:0.00790,(((2000.01_1_A/New_York/433/2000_HOST_Human_H3N2:0.00682,((2008.16_16_A/Boston/64/2008_HOST_Human_H3N2:0.00789,2012.07_122_A/California/17/2012_HOST_Human_H3N2:0.04170):0.00850,2004.59_17_A/Canterbury/12/2004_HOST_Human_H3N2:0.01630):0.05168):0.02633,1996.82_163_A/Lyon/1781/1996_HOST_Human_H3N2:0.00762):0.02564,1988.16_748_A/Netherlands/450/1988_HOST_Human_H3N2:0.00792):0.00826):0.06769,1972.50_48_A/Tokyo/31/72_HOST_Human_H3N2:0.00001):0.04120):0.00000; diff --git a/tests/expected_NP_test_results/modelcomparison.md b/tests/expected_NP_test_results/modelcomparison.md index fd2994d1..65624a93 100644 --- a/tests/expected_NP_test_results/modelcomparison.md +++ b/tests/expected_NP_test_results/modelcomparison.md @@ -1,6 +1,8 @@ -| Model | deltaAIC | LogLikelihood | nParams | ParamValues | -|-------------------------------|----------|---------------|---------|-----------------------------------------------| -| ExpCM_NP_prefs_short | 0.00 | -775.21 | 6 | beta=3.38, kappa=8.76, omega=0.98 | -| averaged_ExpCM_NP_prefs_short | 668.90 | -1109.66 | 6 | beta=0.29, kappa=8.96, omega=0.11 | -| YNGKP_M5 | 677.50 | -1107.96 | 12 | alpha_omega=0.30, beta_omega=2.52, kappa=7.08 | -| YNGKP_M0 | 687.76 | -1114.09 | 11 | kappa=7.00, omega=0.12 | \ No newline at end of file +| Model | deltaAIC | LogLikelihood | nParams | ParamValues | +|------------------------------------------|----------|---------------|---------|----------------------------------------------------------| +| ExpCM_NP_prefs_short | 0.00 | -775.21 | 6 | beta=3.38, kappa=8.76, omega=0.98 | +| ExpCM_NP_prefs_short_gammaomega | 0.84 | -774.63 | 7 | alpha_omega=1.65, beta=3.38, beta_omega=1.65, kappa=8.88 | +| averaged_ExpCM_NP_prefs_short_gammaomega | 661.34 | -1104.88 | 7 | alpha_omega=0.30, beta=0.28, beta_omega=2.49, kappa=8.97 | +| averaged_ExpCM_NP_prefs_short | 668.90 | -1109.66 | 6 | beta=0.29, kappa=8.96, omega=0.11 | +| YNGKP_M5 | 677.50 | -1107.96 | 12 | alpha_omega=0.30, beta_omega=2.52, kappa=7.08 | +| YNGKP_M0 | 687.76 | -1114.09 | 11 | kappa=7.00, omega=0.12 | \ No newline at end of file diff --git a/tests/expected_rel_test_results/real_data/ExpCM_k2_4_omegabycategory.csv b/tests/expected_rel_test_results/real_data/ExpCM_k2_4_omegabycategory.csv new file mode 100644 index 00000000..aced7eca --- /dev/null +++ b/tests/expected_rel_test_results/real_data/ExpCM_k2_4_omegabycategory.csv @@ -0,0 +1,41 @@ +site,post_probability,omega +1,0.2503826180447997,0.0695219697627359 +2,0.24755166505269052,0.0695219697627359 +3,0.2526024760622074,0.0695219697627359 +4,0.2530711698554593,0.0695219697627359 +5,0.24843828974534077,0.0695219697627359 +6,0.24790110562505693,0.0695219697627359 +7,0.2490038624722739,0.0695219697627359 +8,0.24691955431255516,0.0695219697627359 +9,0.2482056879818768,0.0695219697627359 +10,0.25187107406124254,0.0695219697627359 +1,0.2501892716390421,0.24049459110995997 +2,0.248773526348912,0.24049459110995997 +3,0.25128211185265004,0.24049459110995997 +4,0.2515136779522907,0.24049459110995997 +5,0.24921856529930905,0.24049459110995997 +6,0.2489495019733512,0.24049459110995997 +7,0.24950283438983323,0.24049459110995997 +8,0.24845479651474506,0.24049459110995997 +9,0.2491015290261636,0.24049459110995997 +10,0.25092327215868276,0.24049459110995997 +1,0.24994325019212063,0.5026605868928383 +2,0.2503458413911152,0.5026605868928383 +3,0.24960810727725677,0.5026605868928383 +4,0.2495382708513982,0.5026605868928383 +5,0.25022161395376685,0.5026605868928383 +6,0.25029753182725495,0.5026605868928383 +7,0.25014279788412824,0.5026605868928383 +8,0.2504327664839336,0.5026605868928383 +9,0.2502538869248841,0.5026605868928383 +10,0.2497198975128225,0.5026605868928383 +1,0.2494848601240376,1.1954353514926277 +2,0.2533289672072823,1.1954353514926277 +3,0.24650730480788563,1.1954353514926277 +4,0.2458768813408518,1.1954353514926277 +5,0.25212153100158347,1.1954353514926277 +6,0.252851860574337,1.1954353514926277 +7,0.2513505052537647,1.1954353514926277 +8,0.2541928826887663,1.1954353514926277 +9,0.25243889606707554,1.1954353514926277 +10,0.24748575626725222,1.1954353514926277 diff --git a/tests/expected_rel_test_results/real_data/ExpCM_k2_4_posteriorprobabilities.csv b/tests/expected_rel_test_results/real_data/ExpCM_k2_4_posteriorprobabilities.csv new file mode 100644 index 00000000..9ac127d1 --- /dev/null +++ b/tests/expected_rel_test_results/real_data/ExpCM_k2_4_posteriorprobabilities.csv @@ -0,0 +1,11 @@ +site,p(omega > 1) +8,0.2541928826887663 +2,0.2533289672072823 +6,0.252851860574337 +9,0.25243889606707554 +5,0.25212153100158347 +7,0.2513505052537647 +1,0.2494848601240376 +10,0.24748575626725222 +3,0.24650730480788563 +4,0.2458768813408518 diff --git a/tests/expected_rel_test_results/real_data/ExpCM_k2_50_omegabycategory.csv b/tests/expected_rel_test_results/real_data/ExpCM_k2_50_omegabycategory.csv new file mode 100644 index 00000000..9ed1d910 --- /dev/null +++ b/tests/expected_rel_test_results/real_data/ExpCM_k2_50_omegabycategory.csv @@ -0,0 +1,501 @@ +site,post_probability,omega +1,0.02003634830328912,0.005204916546033677 +2,0.019768057697883947,0.005204916546033677 +3,0.020247425179641544,0.005204916546033677 +4,0.020291940778413686,0.005204916546033677 +5,0.019852023671172128,0.005204916546033677 +6,0.019801126046837442,0.005204916546033677 +7,0.019905559862235533,0.005204916546033677 +8,0.01970825223140741,0.005204916546033677 +9,0.01983001011513894,0.005204916546033677 +10,0.020177831183550647,0.005204916546033677 +1,0.020035267292908318,0.01564945972285264 +2,0.01977483170477145,0.01564945972285264 +3,0.020240023824956536,0.01564945972285264 +4,0.020283213204397903,0.01564945972285264 +5,0.019856352578446593,0.01564945972285264 +6,0.01980694174023965,0.01564945972285264 +7,0.019908332894313437,0.01564945972285264 +8,0.01971675616050092,0.01564945972285264 +9,0.019834977763594996,0.01564945972285264 +10,0.020172523769477313,0.01564945972285264 +1,0.020034181034433784,0.02625258345113242 +2,0.019781643293708295,0.02625258345113242 +3,0.02023258818694724,0.02625258345113242 +4,0.020274444996912215,0.02625258345113242 +5,0.01986070523088086,0.02625258345113242 +6,0.019812789415247237,0.02625258345113242 +7,0.01991112074560124,0.02625258345113242 +8,0.019725307902021122,0.02625258345113242 +9,0.019839972861133728,0.02625258345113242 +10,0.0201671913007407,0.02625258345113242 +1,0.02003308619171238,0.03705062151127721 +2,0.019788513479058117,0.03705062151127721 +3,0.020225095460902946,0.03705062151127721 +4,0.02026560926035293,0.03705062151127721 +5,0.019865095051106795,0.03705062151127721 +6,0.01981868710657156,0.03705062151127721 +7,0.019913932005177635,0.03705062151127721 +8,0.019733933852134775,0.03705062151127721 +9,0.01984501081565365,0.03705062151127721 +10,0.020161817414130628,0.03705062151127721 +1,0.02003198134378849,0.04806221162730511 +2,0.019795451303822983,0.04806221162730511 +3,0.020217535965374914,0.04806221162730511 +4,0.020256694572549798,0.04806221162730511 +5,0.019869527809752433,0.04806221162730511 +6,0.019824642569320015,0.04806221162730511 +7,0.019916770357853542,0.04806221162730511 +8,0.019742645382513354,0.04806221162730511 +9,0.019850098255248638,0.04806221162730511 +10,0.02015639515398084,0.04806221162730511 +1,0.020030865512939304,0.059302258456774434 +2,0.01980246305124173,0.059302258456774434 +3,0.020209903059693488,0.059302258456774434 +4,0.020247693096239874,0.059302258456774434 +5,0.019874007512789702,0.059302258456774434 +6,0.019830661188177775,0.059302258456774434 +7,0.019919638356541453,0.059302258456774434 +8,0.019751450402707246,0.059302258456774434 +9,0.019855239783739643,0.059302258456774434 +10,0.020150919743407634,0.059302258456774434 +1,0.02002973788955276,0.07078455002640986 +2,0.01980955396612701,0.07078455002640986 +3,0.020202191259405488,0.07078455002640986 +4,0.020238598356876605,0.07078455002640986 +5,0.019878537501699302,0.07078455002640986 +6,0.01983674745538475,0.07078455002640986 +7,0.019922538127224335,0.07078455002640986 +8,0.019760355520713906,0.07078455002640986 +9,0.01986043924305174,0.07078455002640986 +10,0.020145387233163874,0.07078455002640986 +1,0.020028597734614486,0.08252270772178963 +2,0.01981672886539342,0.08252270772178963 +3,0.020194395568387348,0.08252270772178963 +4,0.02022940445513406,0.08252270772178963 +5,0.019883120843659167,0.08252270772178963 +6,0.01984290549492942,0.08252270772178963 +7,0.01992547161894729,0.08252270772178963 +8,0.01976936680937678,0.08252270772178963 +9,0.01986570016096035,0.08252270772178963 +10,0.020139794022786064,0.08252270772178963 +1,0.02002744433469476,0.09453065019329998 +2,0.019823992420430682,0.09453065019329998 +3,0.020186511170774114,0.09453065019329998 +4,0.020220105703605377,0.09453065019329998 +5,0.019887760511971664,0.09453065019329998 +6,0.01984913930494584,0.09453065019329998 +7,0.01992844071936846,0.09453065019329998 +8,0.019778490160870976,0.09453065019329998 +9,0.019871025958150445,0.09453065019329998 +10,0.020134136639645604,0.09453065019329998 +1,0.020026276977151803,0.10682287500785394 +2,0.019831349313271362,0.10682287500785394 +3,0.020178533261420852,0.10682287500785394 +4,0.020210696426864346,0.10682287500785394 +5,0.019892459485813866,0.10682287500785394 +6,0.019855452891746596,0.10682287500785394 +7,0.01993144731859282,0.10682287500785394 +8,0.019787731482906953,0.10682287500785394 +9,0.019876420062721493,0.10682287500785394 +10,0.020128411617311524,0.10682287500785394 +1,0.02002509493436497,0.11941466344246414 +2,0.019838804336464864,0.11941466344246414 +3,0.0201704569383526,0.11941466344246414 +4,0.020201170834578126,0.11941466344246414 +5,0.019897220814001873,0.11941466344246414 +6,0.019861850355499214,0.11941466344246414 +7,0.019934493349922748,0.11941466344246414 +8,0.01979709682424667,0.11941466344246414 +9,0.019881885983405494,0.11941466344246414 +10,0.020122615418312655,0.11941466344246414 +1,0.020023897452364176,0.1323222527138229 +2,0.019846362465708787,0.1323222527138229 +3,0.020162277125343655,0.1323222527138229 +4,0.02019152293017821,0.1323222527138229 +5,0.01990204766131403,0.1323222527138229 +6,0.019868335952492086,0.1323222527138229 +7,0.01993758081941952,0.1323222527138229 +8,0.019806592466067162,0.1323222527138229 +9,0.019887427362784708,0.1323222527138229 +10,0.020116744378507717,0.1323222527138229 +1,0.02002268374164814,0.14556299733442163 +2,0.01985402891898787,0.14556299733442163 +3,0.020153988509625836,0.14556299733442163 +4,0.020181746437323067,0.14556299733442163 +5,0.019906943346195454,0.14556299733442163 +6,0.01987491414581376,0.14556299733442163 +7,0.01994071182991686,0.14556299733442163 +8,0.019816224996439397,0.14556299733442163 +9,0.019893048020632915,0.14556299733442163 +10,0.020110794662249815,0.14556299733442163 +1,0.020021452969030976,0.15915553189081796 +2,0.019861809209556634,0.15915553189081796 +3,0.020145585486692034,0.15915553189081796 +4,0.020171834734737323,0.15915553189081796 +5,0.0199119113744993,0.15915553189081796 +6,0.019881589650717565,0.15915553189081796 +7,0.01994388860247537,0.15915553189081796 +8,0.019826001377097568,0.15915553189081796 +9,0.019898751992712464,0.15915553189081796 +10,0.02010476222263796,0.15915553189081796 +1,0.020020204249831225,0.1731199433915653 +2,0.01986970919706526,0.1731199433915653 +3,0.020137062107561676,0.1731199433915653 +4,0.020161780793934013,0.1731199433915653 +5,0.01991695547203085,0.1731199433915653 +6,0.019888367478384014,0.1731199433915653 +7,0.019947113497044092,0.1731199433915653 +8,0.019835929007929975,0.1731199433915653 +9,0.01990454356821529,0.1731199433915653 +10,0.020098642763488855,0.1731199433915653 +1,0.020018936639950316,0.18747795953965493 +2,0.019877735139700453,0.18747795953965493 +3,0.0201284120254039,0.18747795953965493 +4,0.0201515771161665,0.18747795953965493 +5,0.01992207961771418,0.18747795953965493 +6,0.01989525298052645,0.18747795953965493 +7,0.01995038903349549,0.18747795953965493 +8,0.019846015792780388,0.18747795953965493 +9,0.019910427327934986,0.18747795953965493 +10,0.020092431700826932,0.18747795953965493 +1,0.020017649127507843,0.20225315868613175 +2,0.01988589374948911,0.20225315868613175 +3,0.020119628439243743,0.20225315868613175 +4,0.020141215665926387,0.20225315868613175 +5,0.019927288078765506,0.20225315868613175 +6,0.019902251896693906,0.20225315868613175 +7,0.019953717913910256,0.20225315868613175 +8,0.019856270209283492,0.20225315868613175 +9,0.01991640818475141,0.20225315868613175 +10,0.02008612412224023,0.20225315868613175 +1,0.02001634062374771,0.21747120732428996 +2,0.019894192252612755,0.21747120732428996 +3,0.02011070403283186,0.21747120732428996 +4,0.020130687798715484,0.21747120732428996 +5,0.019932585449034854,0.21747120732428996 +6,0.019909370405845353,0.21747120732428996 +7,0.019957103046856457,0.21747120732428996 +8,0.019866701385041458,0.21747120732428996 +9,0.01992249142777613,0.21747120732428996 +10,0.020079714742732,0.21747120732428996 +1,0.020015009952944078,0.23316013158044313 +2,0.01990263845649625,0.23316013158044313 +3,0.020101630906844938,0.23316013158044313 +4,0.02011998418093568,0.23316013158044313 +5,0.019937976691649942,0.23316013158044313 +6,0.019916615183710087,0.23316013158044313 +7,0.019960547574380857,0.23316013158044313 +8,0.019877319182384702,0.23316013158044313 +9,0.01992868277145133,0.23316013158044313 +10,0.02007319785573624,0.23316013158044313 +1,0.020013655841027125,0.249350630179922 +2,0.019911240825535595,0.249350630179922 +3,0.02009240050252698,0.249350630179922 +4,0.020109094699656715,0.249350630179922 +5,0.019943467187144428,0.249350630179922 +6,0.019923993467525505,0.249350630179922 +7,0.01996405490246034,0.249350630179922 +8,0.019888134294058654,0.249350630179922 +9,0.019934988410978377,0.249350630179922 +10,0.020066567277940088,0.249350630179922 +1,0.020012276902615193,0.26607643782642865 +2,0.01992000856754228,0.26607643782642865 +3,0.020083003514658023,0.26607643782642865 +4,0.020098008359773014,0.26607643782642865 +5,0.019949062788389347,0.26607643782642865 +6,0.019931513129930873,0.26607643782642865 +7,0.019967628735750254,0.26607643782642865 +8,0.019899158352467115,0.26607643782642865 +9,0.01994141508557164,0.26607643782642865 +10,0.02005981628638631,0.26607643782642865 +1,0.020010871626084715,0.2833747498990397 +2,0.019928951733346946,0.2833747498990397 +3,0.020073429791403256,0.2833747498990397 +4,0.020086713165646454,0.2833747498990397 +5,0.01995476988388112,0.2833747498990397 +6,0.01993918276410473,0.2833747498990397 +7,0.019971273117612067,0.2833747498990397 +8,0.01991040405556005,0.2833747498990397 +9,0.019947970151351,0.2833747498990397 +10,0.02005293754607889,0.2833747498990397 +1,0.020009438356243414,0.30128672196565004 +2,0.01993808133248723,0.30128672196565004 +3,0.020063668218090434,0.30128672196565004 +4,0.020075195983755168,0.30128672196565004 +5,0.019960595471247452,0.30128672196565004 +6,0.019947011782644988,0.30128672196565004 +7,0.019974992476596,0.30128672196565004 +8,0.019921885313056095,0.30128672196565004 +9,0.01995466166600095,0.30128672196565004 +10,0.020045923025971503,0.30128672196565004 +1,0.02000797527406401,0.319858061021073 +2,0.01994740946858127,0.319858061021073 +3,0.020053706581314536,0.319858061021073 +4,0.020063442382098888,0.319858061021073 +5,0.0199665472432553,0.319858061021073 +6,0.019955010533270624,0.319858061021073 +7,0.019978791680823522,0.319858061021073 +8,0.019933617417557694,0.319858061021073 +9,0.01996149848782908,0.319858061021073 +10,0.020038763900723875,0.319858061021073 +1,0.02000648037281391,0.3391397298482444 +2,0.01995694949887137,0.3391397298482444 +3,0.020043531408885505,0.3391397298482444 +4,0.020051436441033056,0.3391397298482444 +5,0.019972633689168358,0.3391397298482444 +6,0.019963190435176303,0.3391397298482444 +7,0.01998267610207073,0.3391397298482444 +8,0.019945617246233255,0.3391397298482444 +9,0.019968490392516403,0.3391397298482444 +10,0.020031450434986088,0.3391397298482444 +1,0.02000495142973065,0.35918879185164365 +2,0.019966716223594045,0.35918879185164365 +3,0.020033127779951115,0.35918879185164365 +4,0.02003916052886827,0.35918879185164365 +5,0.01997886421505433,0.35918879185164365 +6,0.01997156414087439,0.35918879185164365 +7,0.019986651691822628,0.35918879185164365 +8,0.01995790350020824,0.35918879185164365 +9,0.01997564821168393,0.35918879185164365 +10,0.02002397184612233,0.35918879185164365 +1,0.02000338597217215,0.38006943166651014 +2,0.01997672611240187,0.38006943166651014 +3,0.020022479098087628,0.38006943166651014 +4,0.02002659503370371,0.38006943166651014 +5,0.019985249287618984,0.38006943166651014 +6,0.019980145729696787,0.38006943166651014 +7,0.019990725072198148,0.38006943166651014 +8,0.0199704969908068,0.38006943166651014 +9,0.0199829839985743,0.38006943166651014 +10,0.020016316140134535,0.38006943166651014 +1,0.020001781236844648,0.4018541975847269 +2,0.019986997577157998,0.4018541975847269 +3,0.020011566818040626,0.4018541975847269 +4,0.02001371804044977,0.4018541975847269 +5,0.019991800607499166,0.4018541975847269 +6,0.01998895094092083,0.4018541975847269 +7,0.019994903645485583,0.4018541975847269 +8,0.019983420984439018,0.4018541975847269 +9,0.019990511227661597,0.4018541975847269 +10,0.02000846991408224,0.4018541975847269 +1,0.02000013412030065,0.42462552649993446 +2,0.019997551303268513,0.42462552649993446 +3,0.020000370113982684,0.42462552649993446 +4,0.02000050493876211,0.42462552649993446 +5,0.019998531319732057,0.42462552649993446 +6,0.019997997456915436,0.42462552649993446 +7,0.01999919572716905,0.42462552649993446 +8,0.01999670162149815,0.42462552649993446 +9,0.01999824503709074,0.42462552649993446 +10,0.020000418116198168,0.42462552649993446 +1,0.019998441118311477,0.44847763234149307 +2,0.020008410655615844,0.44847763234149307 +3,0.019988865473250492,0.44847763234149307 +4,0.01998692794286638,0.44847763234149307 +5,0.020005456271603227,0.44847763234149307 +6,0.02000730525002979,0.44847763234149307 +7,0.020003610708890784,0.44847763234149307 +8,0.020010368429605997,0.44847763234149307 +9,0.020006202525703155,0.44847763234149307 +10,0.019992143752102898,0.44847763234149307 +1,0.019996698250913547,0.4735188673725418 +2,0.020019602180567853,0.4735188673725418 +3,0.019977026194151364,0.4735188673725418 +4,0.019972955498013728,0.4735188673725418 +5,0.02001259233151832,0.4735188673725418 +6,0.02001689701157337,0.4735188673725418 +7,0.020008159259962983,0.4735188673725418 +8,0.02002445495834757,0.4735188673725418 +9,0.02001440312035226,0.4735188673725418 +10,0.019983627521636956,0.4735188673725418 +1,0.019994900968799394,0.49987470613646356 +2,0.02003115623316303,0.49987470613646356 +3,0.019964821758828907,0.49987470613646356 +4,0.019958551539247273,0.49987470613646356 +5,0.020019958787362548,0.49987470613646356 +6,0.020026798687747416,0.49987470613646356 +7,0.02001285357910056,0.49987470613646356 +8,0.020038999572310288,0.49987470613646356 +9,0.020022869034807544,0.49987470613646356 +10,0.019974847365321947,0.49987470613646356 +1,0.019993044035092375,0.5276915602776486 +2,0.020043107769480085,0.5276915602776486 +3,0.01995221704131625,0.5276915602776486 +4,0.019943674555364745,0.5276915602776486 +5,0.020027577849771907,0.5276915602776486 +6,0.020037040156714522,0.5276915602776486 +7,0.020017707712421617,0.5276915602776486 +8,0.02005404645302588,0.5276915602776486 +9,0.020031625849514883,0.5276915602776486 +10,0.019965777891604825,0.5276915602776486 +1,0.019991121374188688,0.5571417185221195 +2,0.02005549736010031,0.5571417185221195 +3,0.019939171295090583,0.5571417185221195 +4,0.01992827639225212,0.5571417185221195 +5,0.02003547529580288,0.5571417185221195 +6,0.020047656094562286,0.5571417185221195 +7,0.020022737960134797,0.5571417185221195 +8,0.020069646880533244,0.5571417185221195 +9,0.02004070325311272,0.5571417185221195 +10,0.01995638964460459,0.5571417185221195 +1,0.019989125875837416,0.5884298354025412 +2,0.0200683725041793,0.5884298354025412 +3,0.01992563684096828,0.5884298354025412 +4,0.019912300702001274,0.5884298354025412 +5,0.020043681303497114,0.5884298354025412 +6,0.020058687098099354,0.5884298354025412 +7,0.020027963403798175,0.5884298354025412 +8,0.02008586089513905,0.5884298354025412 +9,0.020050136003883712,0.5884298354025412 +10,0.019946648155079873,0.5884298354025412 +1,0.019987049137299102,0.6218015909379481 +2,0.020081789359479647,0.6218015909379481 +3,0.0199115573405369,0.6218015909379481 +4,0.01989568090213136,0.6218015909379481 +5,0.020052231550583974,0.6218015909379481 +6,0.020070181163023556,0.6218015909379481 +7,0.020033406600398172,0.6218015909379481 +8,0.020102759485295815,0.6218015909379481 +9,0.020059965195529512,0.6218015909379481 +10,0.01993651269157008,0.6218015909379481 +1,0.01998488111815518,0.6575554562937451 +2,0.02009581505945453,0.6575554562937451 +3,0.019896865484959163,0.6575554562937451 +4,0.01987833744373023,0.6575554562937451 +5,0.020061168685947026,0.6575554562937451 +6,0.020082195663616745,0.6575554562937451 +7,0.02003909451183581,0.6575554562937451 +8,0.020120427518019065,0.6575554562937451 +9,0.020070239952433858,0.6575554562937451 +10,0.01992593458857442,0.6575554562937451 +1,0.019982609669104253,0.6960590071119281 +2,0.020110530877538592,0.6960590071119281 +3,0.01988147984050252,0.6960590071119281 +4,0.019860174082795248,0.6960590071119281 +5,0.020070544339032343,0.6960590071119281 +6,0.0200948000562084,0.6960590071119281 +7,0.020045059774103723,0.6960590071119281 +8,0.020138967740957664,0.6960590071119281 +9,0.0200810197447381,0.6960590071119281 +10,0.019914854964632356,0.6960590071119281 +1,0.01998021987428573,0.7377720733434264 +2,0.02012603664567341,0.7377720733434264 +3,0.019865300446385487,0.7377720733434264 +4,0.01984107267670279,0.7377720733434264 +5,0.02008042192559802,0.7377720733434264 +6,0.020108079654077397,0.7377720733434264 +7,0.020051342469282276,0.7377720733434264 +8,0.02015850637104628,0.7377720733434264 +9,0.020092377620985327,0.7377720733434264 +10,0.01990320153765637,0.7377720733434264 +1,0.01997769310945257,0.7832804834818542 +2,0.020142457084904128,0.7832804834818542 +3,0.01984820251163295,0.7832804834818542 +4,0.019820885733487833,0.7832804834818542 +5,0.020090880667468117,0.7832804834818542 +6,0.020122141035751138,0.7832804834818542 +7,0.020057992663993766,0.7832804834818542 +8,0.02017920110204474,0.7832804834818542 +9,0.020104404839598335,0.7832804834818542 +10,0.019890884064764625,0.7832804834818542 +1,0.01997500565207276,0.8333468185327803 +2,0.020159951152613192,0.8333468185327803 +3,0.019830027114781792,0.8333468185327803 +4,0.01979942541811878,0.8333468185327803 +5,0.020102021527440436,0.8333468185327803 +6,0.02013712003010796,0.8333468185327803 +7,0.020065074156872673,0.8333468185327803 +8,0.020201252928427595,0.8333468185327803 +9,0.020117217707169458,0.8333468185327803 +10,0.019877787613325877,0.8333468185327803 +1,0.019972126555733594,0.8889896425376128 +2,0.02017872634531252,0.8889896425376128 +3,0.019810566983343665,0.8889896425376128 +4,0.019776446742311368,0.8889896425376128 +5,0.020113976290221585,0.8889896425376128 +6,0.020153193934443293,0.8889896425376128 +7,0.02007267021186464,0.8889896425376128 +8,0.02022492423902398,0.8889896425376128 +9,0.020130968041978857,0.8889896425376128 +10,0.019863762271421267,0.8889896425376128 +1,0.01996901425645557,0.9516128634398227 +2,0.020199061548021504,0.9516128634398227 +3,0.01978954379396307,0.9516128634398227 +4,0.01975162073033205,0.9516128634398227 +5,0.02012692206880828,0.9516128634398227 +6,0.02017060103254071,0.9516128634398227 +7,0.020080892715776958,0.9516128634398227 +8,0.020250567724344127,0.9516128634398227 +9,0.02014585988956174,0.9516128634398227 +10,0.019848606721737893,0.9516128634398227 +1,0.019965610858989666,1.0232289523250078 +2,0.020221345529389163,1.0232289523250078 +3,0.019766569962491456,1.0232289523250078 +4,0.01972448924883294,1.0232289523250078 +5,0.020141105742373072,1.0232289523250078 +6,0.02018967347588992,1.0232289523250078 +7,0.0200898976032728,1.0232289523250078 +8,0.020278675081286317,1.0232289523250078 +9,0.020162177683322433,1.0232289523250078 +10,0.019832040589836175,1.0232289523250078 +1,0.01996183184756577,1.1068720671213708 +2,0.020246146314149616,1.1068720671213708 +3,0.019741079851557753,1.1068720671213708 +4,0.019694383681286325,1.1068720671213708 +5,0.020156887993039455,1.1068720671213708 +6,0.020210896536208108,1.1068720671213708 +7,0.020099912648366806,1.1068720671213708 +8,0.020309964791374164,1.1068720671213708 +9,0.02018033699170688,1.1068720671213708 +10,0.019813654656105142,1.1068720671213708 +1,0.01995754584319194,1.2074363247201145 +2,0.020274347774384215,1.2074363247201145 +3,0.019712194466277512,1.2074363247201145 +4,0.01966026496845326,1.2074363247201145 +5,0.020174830005732485,1.2074363247201145 +6,0.020235025264279484,1.2074363247201145 +7,0.020111292171372603,1.2074363247201145 +8,0.020345554967613,1.2074363247201145 +9,0.02020098443414406,1.2074363247201145 +10,0.019792812920644626,1.2074363247201145 +1,0.01995252958776392,1.3336076045425245 +2,0.020307453660692122,1.3336076045425245 +3,0.019678420652543223,1.3336076045425245 +4,0.019620367983092468,1.3336076045425245 +5,0.02019588643216217,1.3336076045425245 +6,0.020263344137671977,1.3336076045425245 +7,0.020124638774743818,1.3336076045425245 +8,0.020387348123829252,1.3336076045425245 +9,0.020225220071092412,1.3336076045425245 +10,0.01976843485466694,1.3336076045425245 +1,0.01994634758780141,1.5032522794754137 +2,0.020348401331210846,1.5032522794754137 +3,0.019636847136707592,1.5032522794754137 +4,0.019571251006535353,1.5032522794754137 +5,0.020221921801109655,1.5032522794754137 +6,0.020298361946666395,1.5032522794754137 +7,0.02014112906169293,1.5032522794754137 +8,0.020439061116541417,1.5032522794754137 +9,0.020255192600205946,1.5032522794754137 +10,0.019738413343943006,1.5032522794754137 +1,0.019937907220205848,1.7644239551657197 +2,0.02040457342120331,1.7644239551657197 +3,0.019580173897564654,1.7644239551657197 +4,0.019504283400160288,1.7644239551657197 +5,0.02025762156683909,1.7644239551657197 +6,0.020346383389190134,1.7644239551657197 +7,0.020163718694880275,1.7644239551657197 +8,0.020510037556414243,1.7644239551657197 +9,0.020296302118859137,1.7644239551657197 +10,0.019697463671436415,1.7644239551657197 +1,0.019920288620408615,2.4560878431334356 +2,0.020522825728289004,2.4560878431334356 +3,0.019462199576801367,2.4560878431334356 +4,0.019364838434695466,2.4560878431334356 +5,0.020332717168599145,2.4560878431334356 +6,0.020447416737454992,2.4560878431334356 +7,0.02021115449196813,2.4560878431334356 +8,0.020659593142511208,2.4560878431334356 +9,0.020382818992983283,2.4560878431334356 +10,0.01961213074578241,2.4560878431334356 diff --git a/tests/expected_rel_test_results/real_data/ExpCM_k2_50_posteriorprobabilities.csv b/tests/expected_rel_test_results/real_data/ExpCM_k2_50_posteriorprobabilities.csv new file mode 100644 index 00000000..c994cb68 --- /dev/null +++ b/tests/expected_rel_test_results/real_data/ExpCM_k2_50_posteriorprobabilities.csv @@ -0,0 +1,11 @@ +site,p(omega > 1) +8,0.14293023477956962 +2,0.14232509375931826 +6,0.14199110148736102 +9,0.14170303289231415 +5,0.14148097070985508 +7,0.14094174344629737 +1,0.13964206156592715 +10,0.1382549507824147 +3,0.13757748554394356 +4,0.1371398787230561 diff --git a/tests/expected_rel_test_results/real_data/YNGKP_M5_k2_4_omegabycategory.csv b/tests/expected_rel_test_results/real_data/YNGKP_M5_k2_4_omegabycategory.csv new file mode 100644 index 00000000..76d525a1 --- /dev/null +++ b/tests/expected_rel_test_results/real_data/YNGKP_M5_k2_4_omegabycategory.csv @@ -0,0 +1,41 @@ +site,post_probability,omega +1,0.2510262926226661,0.00015886217114892593 +2,0.24982334343725188,0.00015886217114892593 +3,0.24801889249531373,0.00015886217114892593 +4,0.25114547384696184,0.00015886217114892593 +5,0.24978732175161025,0.00015886217114892593 +6,0.24872989780284493,0.00015886217114892593 +7,0.2511786021794438,0.00015886217114892593 +8,0.24890111166292303,0.00015886217114892593 +9,0.24753129152877026,0.00015886217114892593 +10,0.2508003253782533,0.00015886217114892593 +1,0.250895848358314,0.003134887359283535 +2,0.2498454040157611,0.003134887359283535 +3,0.2482660072506427,0.003134887359283535 +4,0.2509997806486802,0.003134887359283535 +5,0.24981410695238473,0.003134887359283535 +6,0.24888892047198824,0.003134887359283535 +7,0.25102865454420376,0.003134887359283535 +8,0.24903915621374767,0.003134887359283535 +9,0.24783901989752813,0.003134887359283535 +10,0.25069869439755166,0.003134887359283535 +1,0.25028804135021865,0.01787419687757662 +2,0.24994871868151108,0.01787419687757662 +3,0.24942364967671524,0.01787419687757662 +4,0.25032105611165173,0.01787419687757662 +5,0.24993924194722406,0.01787419687757662 +6,0.24963308886452992,0.01787419687757662 +7,0.25033016515296386,0.01787419687757662 +8,0.2496845412092244,0.01787419687757662 +9,0.24928089224614916,0.01787419687757662 +10,0.250225019683866,0.01787419687757662 +1,0.24778981766880118,0.09883246559203208 +2,0.25038253386547604,0.09883246559203208 +3,0.2542914505773283,0.09883246559203208 +4,0.24753368939270617,0.09883246559203208 +5,0.250459329348781,0.09883246559203208 +6,0.25274809286063693,0.09883246559203208 +7,0.24746257812338857,0.09883246559203208 +8,0.25237519091410493,0.09883246559203208 +9,0.2553487963275523,0.09883246559203208 +10,0.24827596054032905,0.09883246559203208 diff --git a/tests/expected_rel_test_results/real_data/YNGKP_M5_k2_4_posteriorprobabilities.csv b/tests/expected_rel_test_results/real_data/YNGKP_M5_k2_4_posteriorprobabilities.csv new file mode 100644 index 00000000..2a6c1a70 --- /dev/null +++ b/tests/expected_rel_test_results/real_data/YNGKP_M5_k2_4_posteriorprobabilities.csv @@ -0,0 +1,11 @@ +site,p(omega > 1) +1,0.0 +2,0.0 +3,0.0 +4,0.0 +5,0.0 +6,0.0 +7,0.0 +8,0.0 +9,0.0 +10,0.0 diff --git a/tests/expected_rel_test_results/real_data/YNGKP_M5_k2_50_omegabycategory.csv b/tests/expected_rel_test_results/real_data/YNGKP_M5_k2_50_omegabycategory.csv new file mode 100644 index 00000000..87483682 --- /dev/null +++ b/tests/expected_rel_test_results/real_data/YNGKP_M5_k2_50_omegabycategory.csv @@ -0,0 +1,481 @@ +site,omega,post_probability +1,1e-05,0.060232300668626455 +2,1e-05,0.0599599206726264 +3,1e-05,0.0595502525380599 +4,1e-05,0.060259249262296255 +5,1e-05,0.059951794784342476 +6,1e-05,0.059711845001527694 +7,1e-05,0.06026673665209152 +8,1e-05,0.05975079837373019 +9,1e-05,0.05943944627209456 +10,1e-05,0.060181182074323505 +1,1.01186381966548e-05,0.020077433135466914 +2,1.01186381966548e-05,0.01998664029531545 +3,1.01186381966548e-05,0.019850084976169045 +4,1.01186381966548e-05,0.020086415950830085 +5,1.01186381966548e-05,0.019983931681157887 +6,1.01186381966548e-05,0.019903948846625927 +7,1.01186381966548e-05,0.02008891173370727 +8,1.01186381966548e-05,0.019916933236445104 +9,1.01186381966548e-05,0.019813149749707718 +10,1.01186381966548e-05,0.02006039369696631 +1,2.314901171216402e-05,0.020077386926324284 +2,2.314901171216402e-05,0.019986648104826803 +3,2.314901171216402e-05,0.019850172489005634 +4,2.314901171216402e-05,0.020086364339421507 +5,2.314901171216402e-05,0.019983941167786345 +6,2.314901171216402e-05,0.019904005164668333 +7,2.314901171216402e-05,0.020088858614819485 +8,2.314901171216402e-05,0.01991698213208129 +9,2.314901171216402e-05,0.019813258736953263 +10,2.314901171216402e-05,0.020060357694522295 +1,4.496117498431918e-05,0.020077309584214175 +2,4.496117498431918e-05,0.01998666117606064 +3,4.496117498431918e-05,0.019850318964423484 +4,4.496117498431918e-05,0.020086277955354778 +5,4.496117498431918e-05,0.019983957046026877 +6,4.496117498431918e-05,0.019904099427301335 +7,4.496117498431918e-05,0.020088769707640564 +8,4.496117498431918e-05,0.019917063971258937 +9,4.496117498431918e-05,0.01981344115543444 +10,4.496117498431918e-05,0.020060297435742912 +1,7.824829549269833e-05,0.020077191577019933 +2,7.824829549269833e-05,0.01998668112024809 +3,7.824829549269833e-05,0.019850542457937947 +4,7.824829549269833e-05,0.020086146152189427 +5,7.824829549269833e-05,0.019983981272970446 +6,7.824829549269833e-05,0.01990424325357092 +7,7.824829549269833e-05,0.020088634054797428 +8,7.824829549269833e-05,0.019917188841383483 +9,7.824829549269833e-05,0.01981371949137607 +10,7.824829549269833e-05,0.020060205493906552 +1,0.00012588396589006604,0.020077022750881312 +2,0.00012588396589006604,0.019986709653958875 +3,0.00012588396589006604,0.01985086220565234 +4,0.00012588396589006604,0.020085957589129292 +5,0.00012588396589006604,0.019984015933514458 +6,0.00012588396589006604,0.019904449021883153 +7,0.00012588396589006604,0.02008843998430007 +8,0.00012588396589006604,0.019917367488834253 +9,0.00012588396589006604,0.01981411770142875 +10,0.00012588396589006604,0.02006007395781689 +1,0.000190910155462924,0.02007679238300062 +2,0.000190910155462924,0.01998674859032252 +3,0.000190910155462924,0.0198512985259743 +4,0.000190910155462924,0.020085700290026005 +5,0.000190910155462924,0.019984063229614834 +6,0.000190910155462924,0.0199047298065336 +7,0.000190910155462924,0.02008817517030001 +8,0.000190910155462924,0.01991761126369015 +9,0.000190910155462924,0.01981466109034482 +10,0.000190910155462924,0.020059894472912454 +1,0.00027653124595961503,0.020076489215916676 +2,0.00027653124595961503,0.019986799833426522 +3,0.00027653124595961503,0.019851872756956615 +4,0.00027653124595961503,0.02008536168171437 +5,0.00027653124595961503,0.019984125473367493 +6,0.00027653124595961503,0.019905099337098886 +7,0.00027653124595961503,0.020087826672552957 +8,0.00027653124595961503,0.019917932084249423 +9,0.00027653124595961503,0.019815376233042584 +10,0.00027653124595961503,0.020059658267919493 +1,0.0003861129873590228,0.020076101477758977 +2,0.0003861129873590228,0.019986865375128247 +3,0.0003861129873590228,0.019852607220740906 +4,0.0003861129873590228,0.02008492861670239 +5,0.0003861129873590228,0.019984205083001118 +6,0.0003861129873590228,0.01990557197519393 +7,0.0003861129873590228,0.02008738095979939 +8,0.0003861129873590228,0.01991834241657439 +9,0.0003861129873590228,0.019816290930452365 +10,0.0003861129873590228,0.020059356170584818 +1,0.0005231857982434304,0.020075616891002294 +2,0.0005231857982434304,0.019986947293869805 +3,0.0005231857982434304,0.01985352521045954 +4,0.0005231857982434304,0.020084387383012048 +5,0.0005231857982434304,0.0199843045812624 +6,0.0005231857982434304,0.019906162705600052 +7,0.0005231857982434304,0.02008682391992853 +8,0.0005231857982434304,0.019918855266445844 +9,0.0005231857982434304,0.019817434193356676 +10,0.0005231857982434304,0.02005897861441974 +1,0.0006914521696228218,0.020075022671059654 +2,0.0006914521696228218,0.019987047755269147 +3,0.0006914521696228218,0.01985465099707619 +4,0.0006914521696228218,0.02008372370271353 +5,0.0006914521696228218,0.01998442659592794 +6,0.0006914521696228218,0.01990688714013294 +7,0.0006914521696228218,0.020086140858498622 +8,0.0006914521696228218,0.019919484182306466 +9,0.0006914521696228218,0.01981883625109769 +10,0.0006914521696228218,0.020058515637526593 +1,0.0008947981492899036,0.02007430551542346 +2,0.0008947981492899036,0.019987169014382012 +3,0.0008947981492899036,0.019856009854962598 +4,0.0008947981492899036,0.02008292271989421 +5,0.0008947981492899036,0.019984573862299182 +6,0.0008947981492899036,0.01990776153346182 +7,0.0008947981492899036,0.020085316486405467 +8,0.0008947981492899036,0.019920243268502776 +9,0.0008947981492899036,0.01982052858365306 +10,0.0008947981492899036,0.020057956874032112 +1,0.0011373090487712153,0.020073451583546835 +2,0.0011373090487712153,0.01998731341956896 +3,0.0011373090487712153,0.01985762810590194 +4,0.0011373090487712153,0.020081968978324614 +5,0.0011373090487712153,0.019984749227645388 +6,0.0011373090487712153,0.01990880281067226 +7,0.0011373090487712153,0.0200843348969452 +8,0.0011373090487712153,0.01992114720863052 +9,0.0011373090487712153,0.01982254397670061 +10,0.0011373090487712153,0.0200572915383013 +1,0.001423289659024709,0.02007244646734077 +2,0.001423289659024709,0.01998748341812425 +3,0.001423289659024709,0.01985953318191143 +4,0.001423289659024709,0.020080846388651777 +5,0.001423289659024709,0.019984955657627215 +6,0.001423289659024709,0.019910028606806757 +7,0.001423289659024709,0.020083179532111212 +8,0.001423289659024709,0.01992221129917794 +9,0.001423289659024709,0.019824916600166446 +10,0.001423289659024709,0.02005650840180679 +1,0.0017572894035306258,0.02007127515181479 +2,0.0017572894035306258,0.019987681563580745 +3,0.0017572894035306258,0.01986175370788537 +4,0.0017572894035306258,0.020079538184619324 +5,0.0017572894035306258,0.01998519624481244 +6,0.0017572894035306258,0.01991145731900949 +7,0.0017572894035306258,0.020081833137607457 +8,0.0017572894035306258,0.019923451493997886 +9,0.0017572894035306258,0.01982768211151073 +10,0.0017572894035306258,0.020055595762305544 +1,0.0021441330120818614,0.0200699219651235 +2,0.0021441330120818614,0.019987910524934677 +3,0.0021441330120818614,0.019864319605655396 +4,0.0021441330120818614,0.020078026867477537 +5,0.0021441330120818614,0.01998547421943149 +6,0.0021441330120818614,0.019913108172283745 +7,0.0021441330120818614,0.0200802777057183 +8,0.0021441330120818614,0.019924884460461676 +9,0.0021441330120818614,0.019830877785744692 +10,0.0021441330120818614,0.020054541404730414 +1,0.002588957477303144,0.02006837051693934 +2,0.002588957477303144,0.01998817309796091 +3,0.002588957477303144,0.019867262221699076 +4,0.002588957477303144,0.02007629413739223 +5,0.002588957477303144,0.019985792962591363 +6,0.002588957477303144,0.01991500130026475 +7,0.002588957477303144,0.020078494404810302 +8,0.002588957477303144,0.019926527648501134 +9,0.002588957477303144,0.019834542674970295 +10,0.002588957477303144,0.020053332552956243 +1,0.00309725627095823,0.020066603623739097 +2,0.00309725627095823,0.019988472219018415 +3,0.00309725627095823,0.01987061448144592 +4,0.00309725627095823,0.02007432081026982 +5,0.00309725627095823,0.019986156022326566 +6,0.00309725627095823,0.0199171578428788 +7,0.00309725627095823,0.020076463493841512 +8,0.00309725627095823,0.0199283993741273 +9,0.00309725627095823,0.019838717801123413 +10,0.00309725627095823,0.020051955811333438 +1,0.0036749320627319725,0.020064603219152422 +2,0.0036749320627319725,0.019988810981379772 +3,0.0036749320627319725,0.019874411073977714 +4,0.0036749320627319725,0.020072086717953106 +5,0.0036749320627319725,0.01998656713276803 +6,0.0036749320627319725,0.019919600063287937 +7,0.0036749320627319725,0.020074164219772418 +8,0.0036749320627319725,0.01993051891948655 +9,0.0036749320627319725,0.019843446386666574 +10,0.0036749320627319725,0.020050397094544405 +1,0.004328359518372421,0.020062350247033872 +2,0.004328359518372421,0.01998919265472858 +3,0.004328359518372421,0.01987868867196479 +4,0.004328359518372421,0.020069570589167026 +5,0.004328359518372421,0.019987030237018026 +6,0.004328359518372421,0.019922351487183833 +7,0.004328359518372421,0.020071574695187302 +8,0.004328359518372421,0.019932906652069208 +9,0.004328359518372421,0.01984877412927745 +10,0.004328359518372421,0.020048641543948722 +1,0.005064460180495442,0.020059824534273366 +2,0.005064460180495442,0.019989620708492244 +3,0.005064460180495442,0.019883486192965615 +4,0.005064460180495442,0.020066749907903216 +5,0.005064460180495442,0.019987549514358303 +6,0.005064460180495442,0.01992543706831459 +7,0.005064460180495442,0.020068671752721274 +8,0.005064460180495442,0.019935584166395848 +9,0.005064460180495442,0.01985474952818406 +10,0.005064460180495442,0.020046673428081307 +1,0.005890791985983762,0.020057004639571076 +2,0.005890791985983762,0.01999009883930253 +3,0.005890791985983762,0.01988884510986385 +4,0.005890791985983762,0.02006360074502807 +5,0.005890791985983762,0.01998812941253128 +6,0.005890791985983762,0.019928883385161907 +7,0.005890791985983762,0.020065430771961282 +8,0.005890791985983762,0.019938574452391958 +9,0.005890791985983762,0.019861424271861883 +10,0.005890791985983762,0.02004447602435654 +1,0.006815656692794622,0.02005386767336415 +2,0.006815656692794622,0.019990631003892444 +3,0.006815656692794622,0.019894809820315825 +4,0.006815656692794622,0.020060097557776064 +5,0.006815656692794622,0.01998877468624189 +6,0.006815656692794622,0.01993271887502533 +7,0.006815656692794622,0.020061825473331314 +8,0.006815656692794622,0.01994190209579692 +9,0.006815656692794622,0.019868853699417745 +10,0.006815656692794622,0.020042031478208686 +1,0.00784822943776049,0.02005038908278511 +2,0.00784822943776049,0.01999122145819006 +3,0.00784822943776049,0.019901428087820066 +4,0.00784822943776049,0.020056212950294 +5,0.00784822943776049,0.01998949044305956 +6,0.00784822943776049,0.019936974113492708 +7,0.00784822943776049,0.020057827671931507 +8,0.00784822943776049,0.019945593517448925 +9,0.00784822943776049,0.019877097351416472 +10,0.00784822943776049,0.02003932063488077 +1,0.00899871591301051,0.02004654239375957 +2,0.00899871591301051,0.019991874804389697 +3,0.00899871591301051,0.01990875157061226 +4,0.00899871591301051,0.02005191738645042 +5,0.00899871591301051,0.019990282198510397 +6,0.00899871591301051,0.019941682149566316 +7,0.00899871591301051,0.020053406982323333 +8,0.00899871591301051,0.01994967726021863 +9,0.00899871591301051,0.019886219630388557 +10,0.00899871591301051,0.020036322837695547 +1,0.010278544357605128,0.02004229890005002 +2,0.010278544357605128,0.01999259604752526 +3,0.010278544357605128,0.01991683645938121 +4,0.010278544357605128,0.020047178843578158 +5,0.010278544357605128,0.019991155942469575 +6,0.010278544357605128,0.01994687890972482 +7,0.010278544357605128,0.020048530462567698 +8,0.010278544357605128,0.019954184334967876 +9,0.010278544357605128,0.019896290597237756 +10,0.010278544357605128,0.020033015684820042 +1,0.011700601896108434,0.02003762728590467 +2,0.011700601896108434,0.019993390664223707 +3,0.011700601896108434,0.019925744251233314 +4,0.011700601896108434,0.020041962392275164 +5,0.011700601896108434,0.01999211821974399 +6,0.011700601896108434,0.01995260368829641 +7,0.011700601896108434,0.020043162182276936 +8,0.011700601896108434,0.019959148640391066 +9,0.011700601896108434,0.01990738693781323 +10,0.011700601896108434,0.02002937473410217 +1,0.013279527988425377,0.0200324931647318 +2,0.013279527988425377,0.019994264686760868 +3,0.013279527988425377,0.01993554269613038 +4,0.013279527988425377,0.020036229682696582 +5,0.013279527988425377,0.019993176228614906 +6,0.013279527988425377,0.019958899747064968 +7,0.013279527988425377,0.020037262694526485 +8,0.013279527988425377,0.019964607476354944 +9,0.013279527988425377,0.019919593144888496 +10,0.013279527988425377,0.020025373142219426 +1,0.01503208229360683,0.020026858510307957 +2,0.01503208229360683,0.019995224806700122 +3,0.01503208229360683,0.019946306964176236 +4,0.01503208229360683,0.0200299383111897 +5,0.01503208229360683,0.019994337942310498 +6,0.01503208229360683,0.019965815054731877 +7,0.01503208229360683,0.020030788384771986 +8,0.01503208229360683,0.01997060217693053 +9,0.01503208229360683,0.019933002975972804 +10,0.01503208229360683,0.020020981219757775 +1,0.016977610719864426,0.02002068094878133 +2,0.016977610719864426,0.01999627850396343 +3,0.016977610719864426,0.01995812109918534 +4,0.016977610719864426,0.020023041031924024 +5,0.016977610719864426,0.019995612260273386 +6,0.016977610719864426,0.019973403207640576 +7,0.016977610719864426,0.020023690660419532 +8,0.016977610719864426,0.019977178898533624 +9,0.016977610719864426,0.019947721268689534 +10,0.016977610719864426,0.02001616587739847 +1,0.019138642810308557,0.020013912867946758 +2,0.019138642810308557,0.019997434209267678 +3,0.019138642810308557,0.019971079848302657 +4,0.019138642810308557,0.020015484765063398 +5,0.019138642810308557,0.01999700919848147 +6,0.019138642810308557,0.019981724588568818 +7,0.019138642810308557,0.020015914931255707 +8,0.019138642810308557,0.019984389611763666 +9,0.019138642810308557,0.019963866225855265 +10,0.019138642810308557,0.02001088992915234 +1,0.021541667456319642,0.020006500283180077 +2,0.021541667456319642,0.01999870151104584 +3,0.021541667456319642,0.019985290992773026 +4,0.021541667456319642,0.020007209334002744 +5,0.021541667456319642,0.019998540131840624 +6,0.021541667456319642,0.019990847842733264 +7,0.021541667456319642,0.020007399311377638 +8,0.021541667456319642,0.01999229336461324 +9,0.021541667456319642,0.01998157232652638 +10,0.021541667456319642,0.020005111205225495 +1,0.02421815478027514,0.01999838137413431 +2,0.02421815478027514,0.020000091422573016 +3,0.02421815478027514,0.020000878357268482 +4,0.02421815478027514,0.0199981458360321 +5,0.02421815478027514,0.020000218107027935 +6,0.02421815478027514,0.020000851783237426 +7,0.02421815478027514,0.019998072944299256 +8,0.02421815478027514,0.020000957913020513 +9,0.02421815478027514,0.02000099408463479 +10,0.02421815478027514,0.019998781407300686 +1,0.02720592414469288,0.01998948456807923 +2,0.02720592414469288,0.02000161673207477 +3,0.02720592414469288,0.020017985754317912 +4,0.02720592414469288,0.019988214508252014 +5,0.02720592414469288,0.02000205825238917 +6,0.02720592414469288,0.020011827888221114 +7,0.02720592414469288,0.019987853809229895 +8,0.02720592414469288,0.02001046185748089 +9,0.02720592414469288,0.020022310975692074 +10,0.02720592414469288,0.019991844609124763 +1,0.030551008965601766,0.019979725986549998 +2,0.030551008965601766,0.020003292469449103 +3,0.030551008965601766,0.020036782243043835 +4,0.030551008965601766,0.019977321884641637 +5,0.030551008965601766,0.02000407832420396 +6,0.030551008965601766,0.020023883629521143 +7,0.030551008965601766,0.019976645798715834 +8,0.030551008965601766,0.020020897490720536 +9,0.030551008965601766,0.02004573400529411 +10,0.030551008965601766,0.01998423525893341 +1,0.03431025140050497,0.019969005977730495 +2,0.03431025140050497,0.02000513654055299 +3,0.03431025140050497,0.020057469276786602 +4,0.03431025140050497,0.01996535693529131 +5,0.03431025140050497,0.020006299448808034 +6,0.03431025140050497,0.0200371469961453 +7,0.03431025140050497,0.019964334750057846 +8,0.03431025140050497,0.020032374666941837 +9,0.03431025140050497,0.020071514637246338 +10,0.03431025140050497,0.01997587546653443 +1,0.03855499816905177,0.019957204302346113 +2,0.03855499816905177,0.020007170608511142 +3,0.03855499816905177,0.020080290635150638 +4,0.03855499816905177,0.019952185706626657 +5,0.03855499816905177,0.020008747153341774 +6,0.03855499816905177,0.020051772778698317 +7,0.03855499816905177,0.019950782935918534 +8,0.03855499816905177,0.020045026176466106 +9,0.03855499816905177,0.020099957200138546 +10,0.03855499816905177,0.01996667123677231 +1,0.04337650917513503,0.019944173277711755 +2,0.04337650917513503,0.020009421349877148 +3,0.04337650917513503,0.020105546582294694 +4,0.04337650917513503,0.01993764368862083 +5,0.04337650917513503,0.020011452834333456 +6,0.04337650917513503,0.02006795152608684 +7,0.04337650917513503,0.019935821218572677 +8,0.04337650917513503,0.020059015404405856 +9,0.04337650917513503,0.020131436573752975 +10,0.04337650917513503,0.019956507105254862 +1,0.04889412697288553,0.019929727718529106 +2,0.04889412697288553,0.020011922299430055 +3,0.04889412697288553,0.02013361466207549 +4,0.04889412697288553,0.019921524616188607 +5,0.04889412697288553,0.020014455913493587 +6,0.04889412697288553,0.02008592269787797 +7,0.04889412697288553,0.019919237539014683 +8,0.04889412697288553,0.02007454757492743 +9,0.04889412697288553,0.02016642416717044 +10,0.04889412697288553,0.019945238267380334 +1,0.05526808761484081,0.01991362964629548 +2,0.05526808761484081,0.02001471665718803 +3,0.05526808761484081,0.020164981343578504 +4,0.05526808761484081,0.01990356344731748 +5,0.05526808761484081,0.020017807116399167 +6,0.05526808761484081,0.020105994674489015 +7,0.05526808761484081,0.019900759420663508 +8,0.05526808761484081,0.0200918868547855 +9,0.05526808761484081,0.020205527453240724 +10,0.05526808761484081,0.01993267861336688 +1,0.06272053873314233,0.019895564032526597 +2,0.06272053873314233,0.020017861746278544 +3,0.06272053873314233,0.020200292284435258 +4,0.06272053873314233,0.019883409360944706 +5,0.06272053873314233,0.020021573676762782 +6,0.06272053873314233,0.020128576531733344 +7,0.06272053873314233,0.01988002621514584 +8,0.06272053873314233,0.020111383506538825 +9,0.06272053873314233,0.02024955276487883 +10,0.06272053873314233,0.019918581746130093 +1,0.07157199777738193,0.01987509823659546 +2,0.07157199777738193,0.020021436476210228 +3,0.07157199777738193,0.020240436492377372 +4,0.07157199777738193,0.019860580606154636 +5,0.07157199777738193,0.02002584804445593 +6,0.07157199777738193,0.020154231229886615 +7,0.07157199777738193,0.0198565426946928 +8,0.07157199777738193,0.020133519330841152 +9,0.07157199777738193,0.020299610447066102 +10,0.07157199777738193,0.01990260923744109 +1,0.08230921389092276,0.019851609492909865 +2,0.08230921389092276,0.02002555470218651 +3,0.08230921389092276,0.02028669699784767 +4,0.08230921389092276,0.019834383790329514 +5,0.08230921389092276,0.020030763463493834 +6,0.08230921389092276,0.0201837708084013 +7,0.08230921389092276,0.01982959609533056 +8,0.08230921389092276,0.02015898897541918 +9,0.08230921389092276,0.020357303118056592 +10,0.08230921389092276,0.01988427387574381 +1,0.09572374161397221,0.019824143377545733 +2,0.09572374161397221,0.0200303913374204 +3,0.09572374161397221,0.02034104540941756 +4,0.09572374161397221,0.01980375635147812 +5,0.09572374161397221,0.02003652440071295 +6,0.09572374161397221,0.02021844242445192 +7,0.09572374161397221,0.0197980942111188 +8,0.09572374161397221,0.020188858791650253 +9,0.09572374161397221,0.020425093729235795 +10,0.09572374161397221,0.019862828886839656 +1,0.11323358840121218,0.019791101792422633 +2,0.11323358840121218,0.020036240009612856 +3,0.11323358840121218,0.02040679241618265 +4,0.11323358840121218,0.019766919303914676 +5,0.11323358840121218,0.02004347368322897 +6,0.11323358840121218,0.020260339054939572 +7,0.11323358840121218,0.019760208497548573 +8,0.11323358840121218,0.020224917418789946 +9,0.11323358840121218,0.020507118447910602 +10,0.11323358840121218,0.019837023696399093 +1,0.13778811339167515,0.01974941678823174 +2,0.13778811339167515,0.020043665997693225 +3,0.13778811339167515,0.020490313632622846 +4,0.13778811339167515,0.019720457818565764 +5,0.13778811339167515,0.02005227043671479 +6,0.13778811339167515,0.02031348868399861 +7,0.13778811339167515,0.01971242914781353 +8,0.13778811339167515,0.020270605210333796 +9,0.13778811339167515,0.020611343466256836 +10,0.13778811339167515,0.01980445716130905 +1,0.1774348777552607,0.01969152917789612 +2,0.1774348777552607,0.020054066635673485 +3,0.1774348777552607,0.020607375064106512 +4,0.1774348777552607,0.019655959103497676 +5,0.1774348777552607,0.020064541500674986 +6,0.1774348777552607,0.020387844504974963 +7,0.1774348777552607,0.019646109815651517 +8,0.1774348777552607,0.020334417811918696 +9,0.1774348777552607,0.02075747064115173 +10,0.1774348777552607,0.01975921204831754 +1,0.29087652521054436,0.019570208394454097 +2,0.29087652521054436,0.020076201006783777 +3,0.29087652521054436,0.020856846507874064 +4,0.29087652521054436,0.0195208658168234 +5,0.29087652521054436,0.020090469050030715 +6,0.29087652521054436,0.020545775341028916 +7,0.29087652521054436,0.019507236725926542 +8,0.29087652521054436,0.020469555437997892 +9,0.29087652521054436,0.021069068474919232 +10,0.29087652521054436,0.019664310686652867 diff --git a/tests/expected_rel_test_results/real_data/YNGKP_M5_k2_50_posteriorprobabilities.csv b/tests/expected_rel_test_results/real_data/YNGKP_M5_k2_50_posteriorprobabilities.csv new file mode 100644 index 00000000..2a6c1a70 --- /dev/null +++ b/tests/expected_rel_test_results/real_data/YNGKP_M5_k2_50_posteriorprobabilities.csv @@ -0,0 +1,11 @@ +site,p(omega > 1) +1,0.0 +2,0.0 +3,0.0 +4,0.0 +5,0.0 +6,0.0 +7,0.0 +8,0.0 +9,0.0 +10,0.0 diff --git a/tests/expected_rel_test_results/simulated_data/ExpCM_k2_4_omegabycategory.csv b/tests/expected_rel_test_results/simulated_data/ExpCM_k2_4_omegabycategory.csv new file mode 100644 index 00000000..18d9af40 --- /dev/null +++ b/tests/expected_rel_test_results/simulated_data/ExpCM_k2_4_omegabycategory.csv @@ -0,0 +1,41 @@ +site,post_probability,omega +1,0.45224666238043093,0.41243259989261843 +2,0.24766674273065425,0.41243259989261843 +3,0.0184189960073799,0.41243259989261843 +4,0.14801075633960142,0.41243259989261843 +5,0.2523685507116059,0.41243259989261843 +6,0.24571347558303108,0.41243259989261843 +7,0.24805442789426338,0.41243259989261843 +8,0.24418209903182736,0.41243259989261843 +9,0.2505961444481922,0.41243259989261843 +10,0.2525026157776892,0.41243259989261843 +1,0.27156195541525097,1.1297405349593788 +2,0.24972894416374244,1.1297405349593788 +3,0.14173121844852374,1.1297405349593788 +4,0.2399232199722768,1.1297405349593788 +5,0.25025713601924254,1.1297405349593788 +6,0.24949687576565202,1.1297405349593788 +7,0.24977543807406868,1.1297405349593788 +8,0.249310460708327,1.1297405349593788 +9,0.2500650041704635,1.1297405349593788 +10,0.2502721266874932,1.1297405349593788 +1,0.17827265470218223,2.070977283202017 +2,0.2508228116966034,2.070977283202017 +3,0.3043323366003256,2.070977283202017 +4,0.286333500379017,2.070977283202017 +5,0.24916093586534052,2.070977283202017 +6,0.2515105038353688,2.070977283202017 +7,0.2506864094097814,2.070977283202017 +8,0.25204868866429736,2.070977283202017 +9,0.2497888717584271,2.070977283202017 +10,0.24911353554805163,2.070977283202017 +1,0.09791872750213589,4.327533597346785 +2,0.25178150140899974,4.327533597346785 +3,0.5355174489437706,4.327533597346785 +4,0.3257325233091047,4.327533597346785 +5,0.248213377403811,4.327533597346785 +6,0.2532791448159479,4.327533597346785 +7,0.2514837246218866,4.327533597346785 +8,0.2544587515955483,4.327533597346785 +9,0.24954997962291714,4.327533597346785 +10,0.24811172198676595,4.327533597346785 diff --git a/tests/expected_rel_test_results/simulated_data/ExpCM_k2_4_posteriorprobabilities.csv b/tests/expected_rel_test_results/simulated_data/ExpCM_k2_4_posteriorprobabilities.csv new file mode 100644 index 00000000..1f16e994 --- /dev/null +++ b/tests/expected_rel_test_results/simulated_data/ExpCM_k2_4_posteriorprobabilities.csv @@ -0,0 +1,11 @@ +site,p(omega > 1) +3,0.9815810039926199 +4,0.8519892436603984 +8,0.7558179009681727 +6,0.7542865244169688 +2,0.7523332572693455 +7,0.7519455721057366 +9,0.7494038555518078 +5,0.7476314492883941 +10,0.7474973842223107 +1,0.5477533376195691 diff --git a/tests/expected_simulator_results/expected_simulator_ExpCM.fasta b/tests/expected_simulator_results/expected_simulator_ExpCM.fasta new file mode 100644 index 00000000..54cbea05 --- /dev/null +++ b/tests/expected_simulator_results/expected_simulator_ExpCM.fasta @@ -0,0 +1,4 @@ +>tip1 +CAGGGCAAACAGCAAACGATTCTGGGCGATCTCGGTAGGTCGAGGGTCCATTACACTCAGTGTTTAATAGTGGGTTCCATAAGAATTTCTCCAGGCTGTCTAGCGCTAGGGTGCAAAGTATTTGGCCAGTCTACGCGATCTATACCCCACACGGAACGAATCGTAAGAGGCAGTCTCGTAATAGCCGTAGCCAATGGTCTTGAGTTAGTATTTATAATGTGCCGCACTTTCCACTATTATTTTGGAGGTATGATTTTAGTATTTGGTGCTCAATTCGCAGCACCTCACTTGGTGAAAGCTGCGCGTGTACTGTGGGTCAACTTCTATTTTAGGATGTGCGGGAGCCTGGATTCCGGCATAAACAGCGATCCATACCTGGATGGTAATGAACGTTTGCGGAACTGTATCGCGCTGTGTGTTCCTACAAACAATAGAACGAGAGTTGTTAAACACTTTCTTCACAGGGGACCAGTCTTATCCATGCGACGCTCACAAACTACAGCAGAGGGTGCGTTAGGCCCGGCGGTAGCCAGCAGCGGCTGCCCTTCTAACCAGGGTCATTATGGATCTCTCACGTACTCATTCTGGAATCTCGGATGGTTGGATTCGCTTATCCAGGTGGAGTTATGTCATTGTAGGATAAGACGGAAATGTTGGAACATGCTAAGCTCGCGATTGGGTTTCTTCTCTCGAGGATGTGACGACGATAATGCTCCGAGTCTCTCCCTAACTTGTGTCAAACTACCTTATAAATTGCTTTTCTCTTCGGAATCTCACGGTTACTCGTCAGTTGTTCCGGAGGCCCCGCCCGCTCCCGACCGATGTGATATTCTACCCTGCTTCTTCGTCCAAATGTATGAGGCTGCGGCTGATTCCGTCGTCCGAAACGAGAATTGTCTATCGTCAGCGCGTATCGCCCTGCAGGCCCCCTGGTTGCTAACACGAGCCGCACCACGTGGCGATGAGATCATGACTCGCAGTCCCGCCGATGCCGTGCGACCCGCAACCCACTTATCGGGCTATTTCGCTTCCACCGTTGGCGCATCGACCGGTTGCATACAAGCTAATTCCCGCTCGTTTCTTACTTTAGTGTCTGCCTTTGACGTCAGCCGAAAAAGGGCTAAGATTTCCTATTCCCAGGACGGCTGTCAGCTTCCTGGGGCTACAGCAAGTTCTGGTACGAGTTCGCATTCACCGGCGTTATTCACCTATCCGTTGCATAGGCCGGGAAGTGTATTAGGCTTCCGTTTATACGAGGTCATAAGGAAAACAGGGATAACAGTGCGAGGTGGCCCGCCCCTGTACCGGTGGAAGTCAAATGAAAACCTGAAATTATGGTGCTGGACAATGCAAGACTGTTTTTTAGGTTCTGAGCAGCTAATGTGGAATCACTATCAATTGAGCCCAGCATGCCTGGGCGAATTGAACTCATTCACGCTCCCTGCTGCTTGGCATGCGCCGAATGCTCTCCCGTTGGCACAGGAATGTTTTTGGTTACTAAGTCATCGACTCCGTCCTGTGCAAGGCATAGCCCGAAAGCACCGAGCACGTATAGTCTTGTACTCCTGGTGCCTGAAGAGCACTCCTCCATTGAATTGTGCCTCGCGGTCAGCCACGCGCGACGGTCGTGCCACTAAAGACCTTTGGCATAGCGTACTGCGTATCCTCGAAGGGGCGATTAAGGAGGGGAATGGTGCTTACTTCGTGAACGCATCTTCGGATGGGGCCATTGTCGTAGATGCTACCGTAATGGCCGCAGTAGGAATCGGGCGGGTGGTCATCCACCACAGGGACACAAGGATCTGCATGATCCGATTCGTGGTACGATTCCTCTGTGGGCGTATTTGGAGTCCCCGTGTAACGTCACACGTATGGCAGGACGTGGCTCTTCGAGCTTTACGATTCAATGGTATGGGTCTCATGTTCATGATGGGAACTATTATACGAGACCGTAGCGTAAGGTTGACTCTTAGCTCTAATCTCGTCCTAGTGAGAGTTGGCATCTCGACTTTTGTAGAGTCGGGTTTTCATAAATGTTGTGTTGGCGGACTCCCCGTAGTTGCAGAGGTGAAAGCGTTAATTCCAAGGCGAGGTGGTATGAGTATCGATCACCCACTAGGTCTTCAGGTCCCTGATATGGGTTGTGCAGGGGACTGCAGCGGCGTTCCAGTTGGTGACGCTACCCTGTTAGGCCAGGTGAGTGCTCATTTGGGATCAAAATTTACCCATTTCAAATCGTTCGTAACGGCACGAAAGTTATCCGATGTGACTTGCGGTCTGGATTGTGGAAGCATAAAGGCTCGGTCGCCGGGTTCCTATCTCGGTAGCGAAAGTGCAATTCGGTTGGCATGTGCGCACGTGGGGCGATTCCCGCCCCCGGTCGGATCCCTGGTCGCGTCATTACGGCGGTGGCCCTTACCGCTTGGTCCAAAACCATGGCACTCACAGATTCGGTCCTATGTCCACTCCACCCTACCGCAAAAAGAGGCGGGGGTGATAAGCGCGTGTACTCAGCGCGCTAGGCCACAGTATTCGCTCGGCAGAGCCCTGGGGGTTGTCCATGCCTTGTGTGCCCACGGGCCGCGAGTACTTGGTGGTCTCTCTAATTTGAACAATGATAGTGAGAAGCCGACAGCGGCAGAGATATATGAGTTCGTCCGGAATGTCCAACCGGCCCCCGAATTGCTGTATGTTTTCCCACGATCGAGGTTTATGCATTTTACCGATAACGTCACTGCCTTTTCTGCCGTCTGGGAAGAGCAAAGTATGTTCGTCGAGTTGGTGCTACACACACTCACTCCTGTATTGAATGTAGCATACATTATCCTGGTGATTTGCATGATTAACCGTGGATCGATCAGGAACACGGAGGCGCACCTTTTTTCCGGGTTAAGCCAACACCCGTTCGCCGGGTCTGCGTCTGAGCCACAGGACGACTCAATGAGGGGGAGCCGACTTGCTATATGGTCTGCTCAGGACCTGGCGTTGCACGAACCCGGT +>tip2 +CAGGGCAAACAGCAAACGATTCTGGGCGATCTCGGTAGGTCGAGGGTCCATTACACTCAGTGTTTAATAGTGGGTTCGATAAGAATTTCTCCAGGCTGTCTAGCGCTAGGGTGCAAAGTATTTGGCCAGTCTACGCGATCTATACCCCACACGGAACGAATCGTAAGAGGCAGTCTCGTAATAGCCGTAGCCAATGGTCTTGAGTTAGTATTTATAATGTGCCGCACTTTCCACTATTATTTTGGAGGTATGATTTTAGTATTTGGTGCTCAATTCGCAGCACCTCACTTGGTGAAAGCTGCGCGTGTACTGTGGGTCAACTTCTATTTTAGGATGTGCGGGAGCCTGGATTCCGGCATAAACAGCAATCCATACCTGGATGGTAATGAACGTTTGCGAAACTGTATCGCGCTGTGTGTTCCTACAAACAATAGAACGAGAGTTGTTAAACACTTTCTTCACAGGGGACCAGTCTTATCCATGCGACGCTCACAAACTACAGCAGAGGGTGCGTTAGGCCCGGCGGTAGCCAGCAGCGGCTGCCCTTCTAATCAGGGTCATTATGGATCTCTCACGTACTCATTCTGGAATCTCGGATGGTTGGATTCGCTTATTCAGGTGGAGTTATGCCATTGTAGGATAAGACGGAAATGTTGGAACATGCTAAGCTCGCGATTAGGTTTCCTCTCTCGAGGATGTGACGACGATAATGCTCCGGGTCTCTCCCTAACTTGTGTCAAACTACCTTATAAATTGCTTTTCTCTTCGGAATCTCACGGTTACTCGTCAGTTGTTCCGGAGGCCCCGCCCGCTCCCGACCGATGTGATATTCTACCCTGCTTCTTCGTCCAGATGTATGAGGCTGCGGCTGATTCCGTCGTCCGAAACGAGAATTGTCTATCGTCAGCGCGTATCGCCCTGCAGGCCCCCTGGTTGCTAACACGAGCCGCACCACGTGGCGATGAGATCATGACTCGCAGTCCCGCCGATGCGGTGCGACCCGCAACCCACTTATCGGGCTATTTCGCTTCCACCGTTGGCGCATCGACCGGTTGCATACGAGCTAATTCCCGCTCGTTTCTTACTTTAGTGTCTGCCTTTGACGTCAGCCAAAAAAGGGCTAAGATTTCCTATTCCCAGGACGGCTGTCAGCTTCCTGGGGCTACAGCAAGTTCTGGTACGAGTTCGCATTCACCGGCGTTATTCACCTATCCGTTACATAGGCCGGGAAGTGTATTAGGCTTCCGTTTATACGAGGTCATCAGGAAAACAGGGATAACAGTGCGAGGTGGCCCGCCCCTGTACCGGTGGAAGTCAAATGAAAACCTGAAATTATGGTGCTGGACAATGCAAGACTGTTTTTTAGGTTCTGAGCAGCTAATGTGGAATCACTATCAATTGAGGCCAGCATGCCTGGGCGAATTGAACTCATTCACGCTCCCTGCTGCTTGGCATGCGCCGAATGCTCTCCCGTTGGCACAGGAATGTTTTTGGTTACTAAGTCATCGACTCCGTCCTGTGCAAGGCATAGCCCGAAAGCACCGAGCACGTATAGTCTTGTACTCCTGGTGCCTGAAGAGCACTCCTCCATTGAATTGTGCCTCGCGGTCAGCCACGCGCGACGGTCGTGCTACTAAAGACCTTTGGCATAGCGTACTGCGTATCCTCGAAGGGGCGATTAAGGAGGGGAATGGTGCGTACTTCGTGAACGCATCTTCGGATGGGGCCATTGTCGTAGATGCTACCGTAATGGCCGCAGTAGGAATAGGGCGGGTGGTCATCCACCACAGGGACACAAGAGTCTGCATGATCCGATTCGTGGTACGATTCCTCTGTGGGCGTATTTGGAGTCCCCGTGTAACGTCACATGTATGGCAGGACGTGGCTCTTCGAGCTTTACGATTCAATGGTATGGGTCTCATGTTCATGATGGGATCTATTATACGAGACCGTAGCGTAAGGTTGACTCTTAGCTCTAATCTCGTCCTAGTGAGAGTTGGCATCTCGACTTTTGTAGAGTCGGGTTTTCATAAATGTTGTGTTGGCGGACTCCCCGTAGTTGCAGAGGTGAAAGCGTTAATTCCAAGGCGAGGTGGTATGAGTATCGATCACCCACTAGGTCTTCAGGTCCCTGATATGGGTTGTGCAGGGGACTGCAGCGGAGTTCTAGTTGGTGACGCTACCCTGTTAGGCCAGGTGAGTGCTCATTTGGGATCAAAATTTACCCATTTCAAATCGTTCGTAACGGCACGAAAGTTATCCGATGTGACTTGCGGTCTGGATTGTGGAAGCATAAAGGCTCGGTCGCCGGGTTCCTATCTCGGTAGCGAAAGTGCAATTCGGTTGGCATGTGCGCACGTGGGGCGATTCCCGCCCCCGGTCGGATCCCTGGTCGCGTCATTACGGCGGTGGCCCTTACCGCTAGGTCCAAAACCATGGCACTCACAGATTCGGTCCTATGTCCACTCCACTCTACCGCAAAAAGAGGCGGGGGTGATAAGCGCGTGTACTCAGTGCGCTAGGCCACAGTATTCGCTCGGCAGAGCCCTGGGGGTTGTCCATGCCTTGTGTGCGCACGGGCCGCGAGTACTTGGTGGTCTCTCTAATTTGAACAATGATAGTGAGAAGCCGACAGCGGCAGAGATATATGAGTTCGTCCGGAATGTCCAACCGGCCCCCGAATTGCTGTATGTATTCCCACGATCGAGGTTTATGCATTTTACCGATAACGTCACAGCCTTTTCTGCCGTCTGGGAAGAGCAAAGTATGTTCGTCGAGTTGGTGCTACACACACTCACTCCTGTATTGAATGTAGCATACATTATCCTGGTGATTTGCATGATTAACCGTGGATCGATCAGGAACACGGAGGCGCACCTTTTTTCCGGGTTAAGCCAACACCCGTTCGCCGGGTCTGCGTCTGAGCCACAGGACGACTCAATGAGGGGGAGCCGACTTGCTATGTGGTCTGCTCAGGACCTGGCGTTGCACGAACCCGGT \ No newline at end of file diff --git a/tests/expected_simulator_results/expected_simulator_YNGKP_MO.fasta b/tests/expected_simulator_results/expected_simulator_YNGKP_MO.fasta new file mode 100644 index 00000000..7eeacab3 --- /dev/null +++ b/tests/expected_simulator_results/expected_simulator_YNGKP_MO.fasta @@ -0,0 +1,4 @@ +>tip1 +CTAGTTAAACCCAGCACGATCCGACGGGCACTAGTAATGTGCAACGGTCTAGCCAGCATGTCCTTCCCCGTCTGCTCCACCAAGAGTTGCACGCTATTCGCAGTCCCCGTATCGAACTACTTTTACCCATCAACTCTGTGGCCCCCAAGCAACGTAATTCATGACACAGCGAGCGCTGTCACTCGTGTCCGTAATGCAGGTGATTTAGCTTGGAGCAGCTCCCGGAGTTGTCGATACGTTTGCGGCTACCGACATTGCCTCTTCGGTGGCAGATTACTGGCGCGTCACTGGGCGAAAGGACCGGCAGGCCGATGGGGCAACTGTGTCTTTAGTAGCTGTGTCACCTACTACTGTGTGAGAAACAACGACCACTCTGCAGCCTCGAGACCAGCGTTCGCCAACTCCCACTCCCGGTCTTACGCCAGCACAAGAAATACTCAAGTGGCCAACACCTTCGCCATGCAGTACATCGCGTTCTCGCACGACGGCTCGAGGAACACCGACGGAGCCCCGTTTGCGCGCGCCTACGGTCATACCCGCGGCATTTACACCCAGTCCATCGGCGATTGTCATACCTACTATTGGTGTAACCACGGATTATTAGCCTGGGGCCGGGACGGAGCTTGTTGGCGGTTCAGTAGCAGCGAGAACTTATCCAACATACCTAGCTCCCGATTAGCGTGCTCGTGGCTTGCCTCCCCAGACGCTAACGCTCTCACCCCCTGCGCGATCTCAGGAACACTAGTATGGAAATTGCGCTTCGGATCGGCGGGCCCAGCTTACTCTTACGTCTCTCCGGGTCTGCGCCGTCGTCCGGGCCTCTTCGGTATGCTCCCTTCCTGCTGGGGTCACCAGTCTGCATCCGCGTACGATTATGCCGAACCTACCCGCACCTTGATATCCTGCGTCGCCAGGGAACGACAAGCTCCCTGGTGGCAGACTATCGAGTACATTCACTCTCTAGGACACACTGATGACAGGGGCGCCGGGAGCTACCAAGATTCAAACCCGTGCTCGGCATGCTTATCCTCTACGGGGGTCGGATCCAAGTATTACCAGCACGGCCGATCCCTGTCATTTCCCAGCTGCGCCTTCGGCTTTGCCGCAAGCCTAAACAGGTACAACCGCTCTGTCGTCATCCTCGCGTTTATGCACCATTACCTTACAGAGATTTCCCCCAACGCTTCGCGCTACGAGGCATTCTCCAAGGTGGAATTACAACATACCCTCACTGGCTCCGTCTATCCTTCGCTCTCCGGCAGAACCAACACCCTTAGAAACTACCGGTACCTTCTGGACGAATCCCGTTGGAAGTCAAGCGGCAAAGCAAAATTATGGTCCTGGAGCAGGATCGGCTGGTTTGTGTACTGGCGGCAGAGTAGATCCAGCCATTCCCCCTTGCATGCACCCTGGCGCCTCGAGTGTAAGGTGTGCAACGATCCGTCTGCCGTCCTTGGCCCCAAAGCGCCCGATTGGCTCCACCGCTGTTGTTCGTGGCACACCCACCCCATAGGACGTTCCATCGTCCACGCGCGAACGCACGGTGACGATATAGCGTTTTCCGCTTTGTGCGCTAAGACGACCCTGCGCTTCAGTTTCTATTCCGGCGGTGACAACCGAGACTACGAACTCAGCAACTATCCGTTGCAACCTGATTACGAAAGACCCGAGGGTTATAGCAACGATTCCAACGGTGTACTGTGGGGCAAAGACTCTTCGGGGGGTGCGCCAGCCGGTCGATCTATCTACCCCTCACTCTCCCGAATTTATCCCTACTACCAACAAATGAGCCGCAACACTAGTTCCACCCACATTTGGGTGGCCCCCTCGCTCTGTGTCGACAGCTTGAGGATGCTCCGTAGCTACATCGGCTACATTGCTTACGGCGCTCCCTACTTACTCTCAACATCGATCCGGCCCACCTGGCGCGCAGACAGCATTACCGAGCATCGAACTTCAACTTTGATAGCGAATTCAATCGCATACAGGGCCCAATATGTTATATCTAACTCTGCCCGTTATGTGTTGCCAAAATGTTCTTACGATGTCTCACGCTATTACGGACGTGTCAAATCATGCCACAGACAACCCTGCGCCCCAAGCCCCGGACCGCTTCTGTCCCTCCGAGGTCAAGAACCCGGCTGCCTGTCACTTGGGAGCCTCTGGGGATATGAGGACTCGACCGCGTTAGATATCTCTCAGGTCGCATTGGGCTCGAAATTTACCCCGTTAAAATCCTCTCTCCAGTCCGACAGCTGTTGCGACTCTCTAGTACGGGAGATCTTCCCCACTAGCAACGTGGCCTCCGAGTCAGTCTCACGTGGGATACCGAGTCGTCACCGTTTCCCGTTGGGCCGCTCTGGCCAGTCCCTCCGACCTGTCCATTCCCCCGCCGACTCTTGCATCGCGTGCCTGTGTCCAGGAGTACACAACCTATGTCCTTCAATACCTAGCGTGGTCGTCCAGGTCCACCTACGCCGAACAGGCGTGGGAGGGAGTAGGGATTGCATCGAACTCGACAGGCCTCATTCGTCCCTCGGAAGCGAGCCCTCTGGTGGCAGAGAATTGTTAGGCAGGGGCGCCGAACTCGCTTCTTACGCGTGTACCTTTACAATGCTAACTGGCAATCCAACAGTCGGTCGCATCTACCCTTCCGACGCAAACGGCCGACACCTCCGCGAATTGCGCTCATCCTGCCGACACTGGAATTTAGCCCGCTTTACAGATAAGGCGATAGGCTTGTGCCTGGTGTCAGACGCAAGGCGCAGCGTTGACCTGTGCGCACGTCATACCCTAAACCCCGAGTTCACTGGTGAGTCAAGCACCCGGTCCATCTATCCCCAAAACCGGCGCGGGACCAGGAACAGAGGGCGTCCGGCCTTTTCGGTCTGGAAGACCGAACGATGTGACGCATGCCTGTGCCAGCCACCGGCCCAAGGTAGCACGTGCCACCGCGCGGCAACCTGCTTATCCCCAGCACCTGCCTTCCCCGGTCCGTCA +>tip2 +CTAGTTAAACCCAGCACGATCCGACGGGCACTAGTAATGTGCAACGGTCTAGCCAGCATGTCCTTCCCCGTCTGCTGCACCAAGAGTTGCACGCTATTCGCAGTCCCCGTATCGAACTACTTTTACCCATCAACTCTGTGGCCCCCAAGCAACGTAATTCATGACACAGCGAGCGCTGTCACTCGTGTCCGTAATGCAGGTGATTTAGCTTGGAGCAGCTCCCGGAGTTGTCGATACGTTTGCGGCTACCGACATTGCCTCTTCGGTGGCAGATTACTGGCGCGTCACTGGGCGAAAGGACCGGCATGCCGATGGGGCAACTGTGTCTTTAGTAGCTGTGTCACCTACTACTGTGTGAGAAACAACAACCACTCTGCAGCCTCGAGACCAGCGTTCACCAACTCCCACTCCCGGTCTTACGCCAGCACAAGAAATACTCAAGTGGCCAACACCTTCGCCATGCAGTACAGCGCGTTCTCGCACGACGGCTCGAGGAACACCGACGGAGCCCCGTTTGCGCGCGCCTACGGGCATACCCGCGGCATTTACATCCAGTCCATCGGCGATTGTCATACCTACTATTGGTGTAACCACGGATTATTAGCCTGGGGCTGGGACGGAGCCTGTTGGCGGTTCAGTAGCAGCGAGAACTTATCCAACATACCTAGCTCCCGATTAGCGTGCTCATGGCTTGCCTCCCCAGACGCTAACGCTCTCTCCCCCTGCGCGATCTCAGGAACACTAGTATGGAAATTGCGCTTCGGATCGGCGGGCCCAGCTTACTCTTACGTCTCTCCGGGTCTGCGCCGCCGTCCGGGCCTCTTCGGTATGCTCCCTTCCTGCTGGGGTCATCAGTCTGCATCCGCGTACGATTATGCCGAACCTACCCGCACCTTGATATCCTGCGTCGCCAGGGAACGACAAGCTCCCTGGTGGCAGACTATCGAGTACATTCACTCTCTAGGACACACTGATGACAGGGGCGCCGGCAGCTACCAAGATTCAAACCCGTGCTCGGCATGCTTATCCTCTACGGGGGTCGGATCCAAGTATTACCAGCAGGGCCGATCCCTGTCATTTCCCAGCTGCGCCTTCGGCTTTGCCGCAAGCCGAAACAGGTACAACCGCTCTGTCGTCATCCTCGCGTTTATGCACCATTACCTTACAGAGATTTCCCCCAACGCTTCGCGCTACGAGGCATTCTCCAAGGTGGAATTACAACATACCCTCACTGGCTCCGTCTATCCTTCGCTCTCCGGCAGCACCAACACCCTTAGAAACTACCGGTACCTTCTGGACGAATCCCGTTGGAAGTCAAGCGGCAAAGCAAAATTATGGTCCTGGAGCAGGATCGGCTGGTTTGTGTACTGGCGGCAGAGTAGATCCAGCCATTCCCCCTTGCATGCACCCTGGCGCCTCGAGTGTAAGGTGTGCAACGATCCGTCTGCCGTCCTTGGCCCCAAAGCGCCCGATTGGCTCCACCGCTGTTGTTCGTGGCACACCCACCCCATAGGACGTTCCATCGTCCACGCGCGAACACACGGTGACGATATAGCGTTTTCCGCTTTGTGCGCTAAGACGACCCTGCGCTTCAGTTTCTATTCCGGCGGTGACAACCGAGACTACGAACTTAGCAACTATCCGTTGCAACCTGATTACGAAAGACCCGAGGGTTATAGCAACGATTCCAACGGTGTACTGTGGGGCAAAGACTCTTCGGGGGGTGCGCCAGCCGGCCGATCTATCTACCCCTCACTCTCCCGAATATATCCCTACTACCAACAAATGAGCCGCAACACAGGTTCCACCCACATTTGGGTGGCCCCCTCGCTCTGTGTCGACAGCTTGAGGATGCTCCGTAGCTACATCGGCTACATTGCTTACGGCGCTCCCTACTTACTCTCAACATCGATCCGGCCCACCTGGCGCGCAGACTGCATTACCGAGCATCGAACTTCAACTTTGATAGCGAATTCAATCGCATACAGGGCCCAATATGTTATATCTAACTCTGCCCGTTATGTGTTGCCAAAATGTTCTTACGATGTCTCACGCTATTACGGACGTGTCAAATCATGCCACAGACAACCCTGCGCCCCAAGCCCCGGACCGCTTCTGTCCCTCCGAGGTCAAGAACCCGGCTGCCTGTCACTTGGGAGCCTCTGGGGGTATGAGGACTCGACCGCGTTAGATATCTCTCAGGTCGCATTAGGCTCGAAATTTACCCCGTTAAAATCCTCTCTCCAGTCCGACAGCTGTTGCGACTCTCTAGTACGGGAGATCTTCCCCACTAGCAACGTGGCCTCCGAGTCAGTCTCACGTGGGATACCGAGTCGTCACCGTTTCCCGTTGGGCCGCTCTGGCCAGTCCCTCCGACCTGTCCATTCCCCCGCCGACTCTTGCATCGCGTGCCTGTGTCCAGGAGTACACAACCTATGTCCCTCAATACCTAGCGTGGTCGTCCAGGTCCACCTACGCCGAACAGGCGTGGGAGGGAGTAGGGATTGCATCGAATTCGACAGGCCTCATTCGTCCCTCGGAAGCGACCCCTCTGGTGGCAGAGAATTGTTAGGCAGGGGCGCCGAACTCGCTTCTTACGCGTGTACCTTTACAATGCTAACTGGCAATCCAACAGTCGGTCGCATCTACCCTTCCGACGCAAACGGCCGACACCTCCGCGAATTGCGCTCAGCCTGCCGACACTGGAATTTAGCCCGCTTTACAGATAAGGCGACAGGCTTGTGCCTGGTGTCAGACGCAAGGCGCAGCGTTGACCTGTGCGCACGCCATACCCTAAACCCCGAGTTCACTGGTGAGTCAAGCACCCGGTCCATCTATCCCCAAAACCGGCGCGGGACCAGGAACAGAGGGCGTCCGGCCTTTTCGGTCTGGAAGACCGAACGATGTGACGCATGCCTGTGCCAGCCACCGGCCCAAGGTAGCACGTGCCACCGCGCGGCAGCCTGCTTATCCCCAGCACCTGCCTTCCCCGGTCCGTCA \ No newline at end of file diff --git a/tests/run_time_test.err b/tests/run_time_test.err deleted file mode 100644 index d7aa0d9f..00000000 --- a/tests/run_time_test.err +++ /dev/null @@ -1,481 +0,0 @@ -2018-05-24 08:57:04,045 - INFO - Beginning execution of phydms_divpressure in directory /home/shilton/phydms/tests - -2018-05-24 08:57:04,045 - INFO - Progress is being logged to /home/shilton/phydms/tests/divpressure_test_results/log.log - -2018-05-24 08:57:04,045 - INFO - Version information: - Time and date: Thu May 24 08:57:01 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -2018-05-24 08:57:04,045 - INFO - Parsed the following command-line arguments: - outprefix = /home/shilton/phydms/tests/divpressure_test_results/ - alignment = /home/shilton/phydms/tests/divpressure_tests/simulated_NP.fasta - prefsfile = /home/shilton/phydms/tests/divpressure_tests/NP_prefs.txt - divpressure = ['/home/shilton/phydms/tests/divpressure_tests/divpressure.txt', '/home/shilton/phydms/tests/divpressure_tests/divpressure2.csv'] - tree = /home/shilton/phydms/tests/divpressure_tests/NP_tree.newick - raxml = raxml - randomizations = 0 - ncpus = -1 - -2018-05-24 08:57:04,055 - INFO - Beginning execution of phydms_divpressure in directory /home/shilton/phydms/tests - -2018-05-24 08:57:04,056 - INFO - Progress is being logged to /home/shilton/phydms/tests/divpressure_test_results/log.log - -2018-05-24 08:57:04,058 - INFO - Version information: - Time and date: Thu May 24 08:57:04 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -2018-05-24 08:57:04,059 - INFO - Parsed the following command-line arguments: - outprefix = /home/shilton/phydms/tests/divpressure_test_results/ - alignment = /home/shilton/phydms/tests/divpressure_tests/simulated_NP.fasta - prefsfile = /home/shilton/phydms/tests/divpressure_tests/NP_prefs.txt - divpressure = ['/home/shilton/phydms/tests/divpressure_tests/divpressure.txt', '/home/shilton/phydms/tests/divpressure_tests/divpressure2.csv'] - tree = /home/shilton/phydms/tests/divpressure_tests/NP_tree.newick - raxml = raxml - randomizations = 0 - ncpus = -1 - -2018-05-24 08:57:04,061 - INFO - Checking that the alignment /home/shilton/phydms/tests/divpressure_tests/simulated_NP.fasta is valid... -2018-05-24 08:57:04,087 - INFO - Valid alignment specifying 19 sequences of length 150. - -2018-05-24 08:57:04,088 - INFO - Reading tree from /home/shilton/phydms/tests/divpressure_tests/NP_tree.newick -2018-05-24 08:57:04,090 - INFO - Will use all 28 available CPUs. - -2018-05-24 08:57:04,096 - INFO - Starting analysis. Optimizing the branch lengths. The command is: phydms /home/shilton/phydms/tests/divpressure_tests/simulated_NP.fasta /home/shilton/phydms/tests/divpressure_tests/NP_tree.newick ExpCM_/home/shilton/phydms/tests/divpressure_tests/NP_prefs.txt /home/shilton/phydms/tests/divpressure_test_results/ExpCM_NP_prefs --ncpus 8 --brlen optimize - -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -2018-05-24 08:57:06,997 - INFO - Beginning execution of phydms in directory /home/shilton/phydms/tests - -2018-05-24 08:57:06,997 - INFO - Progress is being logged to /home/shilton/phydms/tests/divpressure_test_results/ExpCM_NP_prefs_log.log - -2018-05-24 08:57:06,997 - INFO - Version information: - Time and date: Thu May 24 08:57:05 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -2018-05-24 08:57:06,997 - INFO - Parsed the following arguments: - alignment = /home/shilton/phydms/tests/divpressure_tests/simulated_NP.fasta - tree = /home/shilton/phydms/tests/divpressure_tests/NP_tree.newick - model = ('ExpCM', '/home/shilton/phydms/tests/divpressure_tests/NP_prefs.txt') - outprefix = /home/shilton/phydms/tests/divpressure_test_results/ExpCM_NP_prefs - brlen = optimize - gammaomega = False - gammabeta = False - omegabysite = False - omegabysite_fixsyn = False - diffprefsbysite = False - diffprefsprior = ('invquadratic', 150.0, 0.5) - fitphi = False - randprefs = False - avgprefs = False - divpressure = None - ncpus = 8 - fitprefsmethod = 2 - ncats = 4 - minbrlen = 1e-06 - minpref = 0.002 - seed = 1 - initparams = None - profile = False - opt_details = False - nograd = False - -2018-05-24 08:57:06,998 - INFO - Random number seed: 1 - -2018-05-24 08:57:06,998 - INFO - Reading alignment from /home/shilton/phydms/tests/divpressure_tests/simulated_NP.fasta -2018-05-24 08:57:07,018 - INFO - Read 19 aligned sequences from /home/shilton/phydms/tests/divpressure_tests/simulated_NP.fasta, each consisting of 50 codons. - -2018-05-24 08:57:07,018 - INFO - The model will be an ExpCM informed by site-specific amino-acid preferences in /home/shilton/phydms/tests/divpressure_tests/NP_prefs.txt -2018-05-24 08:57:07,052 - INFO - Successfully read site-specific amino-acid preferences for all 50 sites. - -2018-05-24 08:57:07,052 - INFO - Nucleotide frequency parameters phi will be set so stationary state matches alignment nucleotide frequencies of A = 0.318, C = 0.168, G = 0.319, T = 0.195 - -2018-05-24 08:57:07,268 - INFO - Reading tree from /home/shilton/phydms/tests/divpressure_tests/NP_tree.newick -2018-05-24 08:57:07,270 - INFO - Tree has 19 tips. -2018-05-24 08:57:07,272 - INFO - Adjusted 1 branch lengths up to minbrlen 1e-06 - -2018-05-24 08:57:07,273 - INFO - Initializing TreeLikelihood.. -2018-05-24 08:57:07,911 - INFO - TreeLikelihood initialized. -2018-05-24 08:57:07,911 - INFO - Maximizing log likelihood (initially -658.05). -2018-05-24 08:57:07,911 - INFO - Branch lengths will be optimized individually. -2018-05-24 08:57:27,132 - INFO - Maximization complete: - Step 1: optimized parameters, loglik went from -658.05 to -554.16 (15 iterations, 18 function evals) - Step 2: optimized branches, loglik went from -554.16 to -532.76 (17 iterations, 25 function evals) - Step 3: optimized parameters, loglik went from -532.76 to -532.76 (4 iterations, 6 function evals) -2018-05-24 08:57:27,133 - INFO - Optimized log likelihood is -532.76. -2018-05-24 08:57:27,133 - INFO - Writing log likelihood to /home/shilton/phydms/tests/divpressure_test_results/ExpCM_NP_prefs_loglikelihood.txt -2018-05-24 08:57:27,135 - INFO - Model parameters after optimization: - beta = 1.87232 - kappa = 1.87852 - omega = 1.05405 - phiA = 0.31276 - phiC = 0.170538 - phiG = 0.304433 -2018-05-24 08:57:27,135 - INFO - Writing model parameters to /home/shilton/phydms/tests/divpressure_test_results/ExpCM_NP_prefs_modelparams.txt -2018-05-24 08:57:27,136 - INFO - Writing the optimized tree to /home/shilton/phydms/tests/divpressure_test_results/ExpCM_NP_prefs_tree.newick - -2018-05-24 08:57:27,139 - INFO - Successful completion of phydms -2018-05-24 08:57:27,277 - INFO - Analysis successful for NP_prefs without diversifying pressure. - -2018-05-24 08:57:49,315 - INFO - Analysis successful for NP_prefs with diversifying pressure divpressure - -2018-05-24 08:57:49,317 - INFO - Analysis successful for NP_prefs with diversifying pressure divpressure2 - -2018-05-24 08:57:50,401 - INFO - Successful completion of phydms_divpressure - -Running tests in test_YNGKPM0.py... -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -/home/shilton/miniconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ - return f(*args, **kwds) -All tests were successful. - -Running tests in test_brlenderivatives.py... -/home/shilton/.local/lib/python3.6/site-packages/Pyvolve-0.8.4-py3.6.egg/pyvolve/matrix_builder.py:256: DeprecationWarning: invalid escape sequence \m -/home/shilton/.local/lib/python3.6/site-packages/Pyvolve-0.8.4-py3.6.egg/pyvolve/matrix_builder.py:256: DeprecationWarning: invalid escape sequence \m -All tests were successful. - -Running tests in test_brlenoptimize.py... -All tests were successful. - -Running tests in test_doctests.py... -All tests were successful. - -Running tests in test_expcm.py... -All tests were successful. - -Running tests in test_expcm_divpressure.py... -All tests were successful. - -Running tests in test_expcm_empirical_phi.py... -All tests were successful. - -Running tests in test_expcm_fitprefs.py... -All tests were successful. - -Running tests in test_expcm_fitprefs_invquadraticprior.py... -All tests were successful. - -Running tests in test_phydms_divpressure.py... -All tests were successful. - -Running tests in test_phydms_logoplot.py... -All tests were successful. - -Running tests in test_prepalignment.py... -All tests were successful. - -Running tests in test_readDivPressure.py... -All tests were successful. - -Running tests in test_readprefs.py... -All tests were successful. - -Running tests in test_treelikelihood.py... -All tests were successful. - -Running tests in test_alignmentSimulation.py... -All tests were successful. - -Running tests in test_spielmanwr.py... -All tests were successful. - -Running tests in test_treelikelihood_fitprefs.py... -All tests were successful. - -Running tests in test_gammadistributedomega_model.py... -All tests were successful. - -Running tests in test_underflow.py... -All tests were successful. - -Running tests in test_alignmentSimulationRandomSeed.py... -All tests were successful. - -Running tests in test_alignmentSimulation_divpressure.py... -All tests were successful. - -Running tests in test_gammadistributedbeta_model.py... -All tests were successful. - -Testing complete. All passed successfully. diff --git a/tests/run_time_test.out b/tests/run_time_test.out deleted file mode 100644 index 2d6caeff..00000000 --- a/tests/run_time_test.out +++ /dev/null @@ -1,547 +0,0 @@ - -Beginning execution of phydms_logoplot in directory /home/shilton/phydms/tests at time Thu May 24 08:57:52 2018 - -Version information: - Time and date: Thu May 24 08:57:52 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -Parsed the following command-line arguments: - prefs = None - diffprefs = /home/shilton/phydms/tests/expected_NP_test_results/ExpCM_NP_prefs_diffprefsbysite.txt - outfile = /home/shilton/phydms/tests/logoplot_test_results/diffprefs_logoplot.pdf - stringency = 1 - nperline = 72 - numberevery = 10 - mapmetric = functionalgroup - colormap = jet - diffprefheight = 1.0 - omegabysite = None - minP = 0.0001 - -Reading differential preferences from /home/shilton/phydms/tests/expected_NP_test_results/ExpCM_NP_prefs_diffprefsbysite.txt -Read differential preferences for 498 sites. - -Now making plot /home/shilton/phydms/tests/logoplot_test_results/diffprefs_logoplot.pdf... -Created plot /home/shilton/phydms/tests/logoplot_test_results/diffprefs_logoplot.pdf - -Successful completion of phydms_logoplot - -Beginning execution of phydms_logoplot in directory /home/shilton/phydms/tests at time Thu May 24 08:57:59 2018 - -Version information: - Time and date: Thu May 24 08:57:59 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -Parsed the following command-line arguments: - prefs = /home/shilton/phydms/tests/NP_data/NP_prefs.tsv - diffprefs = None - outfile = /home/shilton/phydms/tests/logoplot_test_results/omegaoverlay_logoplot.pdf - stringency = 2.99 - nperline = 72 - numberevery = 10 - mapmetric = functionalgroup - colormap = jet - diffprefheight = 1.0 - omegabysite = /home/shilton/phydms/tests/expected_NP_test_results/ExpCM_NP_prefs_omegabysite.txt - minP = 0.001 - -Reading preferences from /home/shilton/phydms/tests/NP_data/NP_prefs.tsv -Read preferences for 498 sites. -Re-scaling by stringency parameter 2.99 - -We will make an overlay with the site-specific omega values in /home/shilton/phydms/tests/expected_NP_test_results/ExpCM_NP_prefs_omegabysite.txt. - -Now making plot /home/shilton/phydms/tests/logoplot_test_results/omegaoverlay_logoplot.pdf... -Created plot /home/shilton/phydms/tests/logoplot_test_results/omegaoverlay_logoplot.pdf - -Successful completion of phydms_logoplot - -Beginning execution of phydms_logoplot in directory /home/shilton/phydms/tests at time Thu May 24 08:58:10 2018 - -Version information: - Time and date: Thu May 24 08:58:10 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -Parsed the following command-line arguments: - prefs = /home/shilton/phydms/tests/NP_data/NP_prefs.tsv - diffprefs = None - outfile = /home/shilton/phydms/tests/logoplot_test_results/prefs_logoplot.pdf - stringency = 2.99 - nperline = 72 - numberevery = 10 - mapmetric = charge - colormap = jet - diffprefheight = 1.0 - omegabysite = None - minP = 0.0001 - -Reading preferences from /home/shilton/phydms/tests/NP_data/NP_prefs.tsv -Read preferences for 498 sites. -Re-scaling by stringency parameter 2.99 - -Now making plot /home/shilton/phydms/tests/logoplot_test_results/prefs_logoplot.pdf... -Created plot /home/shilton/phydms/tests/logoplot_test_results/prefs_logoplot.pdf - -Successful completion of phydms_logoplot - -Beginning execution of phydms_prepalignment in directory /home/shilton/phydms/tests at time Thu May 24 08:58:17 2018 - -Version information: - Time and date: Thu May 24 08:58:17 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -Parsed the following command-line arguments: - inseqs = /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta - alignment = /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqs.fasta - refseq = Hsap - prealigned = True - mafft = mafft - minidentity = 0.7 - minuniqueness = 2 - purgeseqs = [''] - keepseqs = [''] - -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqs.pdf -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqs.fasta -There are 0 sequences specified by --keepseqs -There are 0 sequences specified by --purgeseqs -Read 67 sequences from /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta -Retained 67 after removing those specified for purging by '--purgeseqs.' -Retained 67 sequences after removing any with length not multiple of 3. -Retained 62 sequences after purging any with ambiguous nucleotides. -Retained 62 sequences after purging any with premature stops or that are otherwise un-translateable. -Using the following as reference sequence: ENSP00000376077_Hsap/1-303 -Purged sequences encoding redundant proteins, being sure to retain reference sequence and any specified by '--keepseqs'. Overall, 54 sequences remain. -You specified '--prealigned', so the sequences are NOT being aligned. -After stripping gaps relative to reference sequence, all proteins are of length 101 -Retained 48 sequences after purging those with < 0.7 protein identity to reference sequence. -Retained 32 sequences after purging those without at least 2 amino-acid differences with other retained sequences. -Writing the final alignment of 32 coding sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqs.fasta -Plotting retained and purged sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqs.pdf - -Successful completion of phydms_prepalignment - -Beginning execution of phydms_prepalignment in directory /home/shilton/phydms/tests at time Thu May 24 08:58:21 2018 - -Version information: - Time and date: Thu May 24 08:58:21 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -Parsed the following command-line arguments: - inseqs = /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta - alignment = /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.6_minuniqueness2_purgeseqs_keepseqs.fasta - refseq = Hsap - prealigned = True - mafft = mafft - minidentity = 0.6 - minuniqueness = 2 - purgeseqs = [''] - keepseqs = [''] - -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.6_minuniqueness2_purgeseqs_keepseqs.pdf -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.6_minuniqueness2_purgeseqs_keepseqs.fasta -There are 0 sequences specified by --keepseqs -There are 0 sequences specified by --purgeseqs -Read 67 sequences from /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta -Retained 67 after removing those specified for purging by '--purgeseqs.' -Retained 67 sequences after removing any with length not multiple of 3. -Retained 62 sequences after purging any with ambiguous nucleotides. -Retained 62 sequences after purging any with premature stops or that are otherwise un-translateable. -Using the following as reference sequence: ENSP00000376077_Hsap/1-303 -Purged sequences encoding redundant proteins, being sure to retain reference sequence and any specified by '--keepseqs'. Overall, 54 sequences remain. -You specified '--prealigned', so the sequences are NOT being aligned. -After stripping gaps relative to reference sequence, all proteins are of length 101 -Retained 51 sequences after purging those with < 0.6 protein identity to reference sequence. -Retained 35 sequences after purging those without at least 2 amino-acid differences with other retained sequences. -Writing the final alignment of 35 coding sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.6_minuniqueness2_purgeseqs_keepseqs.fasta -Plotting retained and purged sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.6_minuniqueness2_purgeseqs_keepseqs.pdf - -Successful completion of phydms_prepalignment - -Beginning execution of phydms_prepalignment in directory /home/shilton/phydms/tests at time Thu May 24 08:58:25 2018 - -Version information: - Time and date: Thu May 24 08:58:25 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -Parsed the following command-line arguments: - inseqs = /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta - alignment = /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness1_purgeseqs_keepseqs.fasta - refseq = Hsap - prealigned = True - mafft = mafft - minidentity = 0.7 - minuniqueness = 1 - purgeseqs = [''] - keepseqs = [''] - -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness1_purgeseqs_keepseqs.pdf -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness1_purgeseqs_keepseqs.fasta -There are 0 sequences specified by --keepseqs -There are 0 sequences specified by --purgeseqs -Read 67 sequences from /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta -Retained 67 after removing those specified for purging by '--purgeseqs.' -Retained 67 sequences after removing any with length not multiple of 3. -Retained 62 sequences after purging any with ambiguous nucleotides. -Retained 62 sequences after purging any with premature stops or that are otherwise un-translateable. -Using the following as reference sequence: ENSP00000376077_Hsap/1-303 -Purged sequences encoding redundant proteins, being sure to retain reference sequence and any specified by '--keepseqs'. Overall, 54 sequences remain. -You specified '--prealigned', so the sequences are NOT being aligned. -After stripping gaps relative to reference sequence, all proteins are of length 101 -Retained 48 sequences after purging those with < 0.7 protein identity to reference sequence. -Retained 42 sequences after purging those without at least 1 amino-acid differences with other retained sequences. -Writing the final alignment of 42 coding sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness1_purgeseqs_keepseqs.fasta -Plotting retained and purged sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness1_purgeseqs_keepseqs.pdf - -Successful completion of phydms_prepalignment - -Beginning execution of phydms_prepalignment in directory /home/shilton/phydms/tests at time Thu May 24 08:58:28 2018 - -Version information: - Time and date: Thu May 24 08:58:28 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -Parsed the following command-line arguments: - inseqs = /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta - alignment = /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqsPanuGgor.fasta - refseq = Hsap - prealigned = True - mafft = mafft - minidentity = 0.7 - minuniqueness = 2 - purgeseqs = [''] - keepseqs = ['Panu', 'Ggor'] - -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqsPanuGgor.pdf -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqsPanuGgor.fasta -There are 2 sequences specified by --keepseqs -There are 0 sequences specified by --purgeseqs -Read 67 sequences from /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta -Retained 67 after removing those specified for purging by '--purgeseqs.' -Retained 67 sequences after removing any with length not multiple of 3. -Retained 62 sequences after purging any with ambiguous nucleotides. -Retained 62 sequences after purging any with premature stops or that are otherwise un-translateable. -Using the following as reference sequence: ENSP00000376077_Hsap/1-303 -Purged sequences encoding redundant proteins, being sure to retain reference sequence and any specified by '--keepseqs'. Overall, 56 sequences remain. -You specified '--prealigned', so the sequences are NOT being aligned. -After stripping gaps relative to reference sequence, all proteins are of length 101 -Retained 50 sequences after purging those with < 0.7 protein identity to reference sequence. -Retained 34 sequences after purging those without at least 2 amino-acid differences with other retained sequences. -Writing the final alignment of 34 coding sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqsPanuGgor.fasta -Plotting retained and purged sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqsPanuGgor.pdf - -Successful completion of phydms_prepalignment - -Beginning execution of phydms_prepalignment in directory /home/shilton/phydms/tests at time Thu May 24 08:58:32 2018 - -Version information: - Time and date: Thu May 24 08:58:32 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -Parsed the following command-line arguments: - inseqs = /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta - alignment = /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqstest_keepseqsfile.fasta - refseq = Hsap - prealigned = True - mafft = mafft - minidentity = 0.7 - minuniqueness = 2 - purgeseqs = [''] - keepseqs = ['/home/shilton/phydms/tests/prepalignment_tests/test_keepseqsfile.txt'] - -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqstest_keepseqsfile.pdf -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqstest_keepseqsfile.fasta -Read 2 sequences from the --keepseqs file /home/shilton/phydms/tests/prepalignment_tests/test_keepseqsfile.txt -There are 0 sequences specified by --purgeseqs -Read 67 sequences from /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta -Retained 67 after removing those specified for purging by '--purgeseqs.' -Retained 67 sequences after removing any with length not multiple of 3. -Retained 62 sequences after purging any with ambiguous nucleotides. -Retained 62 sequences after purging any with premature stops or that are otherwise un-translateable. -Using the following as reference sequence: ENSP00000376077_Hsap/1-303 -Purged sequences encoding redundant proteins, being sure to retain reference sequence and any specified by '--keepseqs'. Overall, 56 sequences remain. -You specified '--prealigned', so the sequences are NOT being aligned. -After stripping gaps relative to reference sequence, all proteins are of length 101 -Retained 50 sequences after purging those with < 0.7 protein identity to reference sequence. -Retained 34 sequences after purging those without at least 2 amino-acid differences with other retained sequences. -Writing the final alignment of 34 coding sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqstest_keepseqsfile.fasta -Plotting retained and purged sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqstest_keepseqsfile.pdf - -Successful completion of phydms_prepalignment - -Beginning execution of phydms_prepalignment in directory /home/shilton/phydms/tests at time Thu May 24 08:58:36 2018 - -Version information: - Time and date: Thu May 24 08:58:36 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -Parsed the following command-line arguments: - inseqs = /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta - alignment = /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqstest_purgeseqsfile_keepseqsPanuGgor.fasta - refseq = Hsap - prealigned = True - mafft = mafft - minidentity = 0.7 - minuniqueness = 2 - purgeseqs = ['/home/shilton/phydms/tests/prepalignment_tests/test_purgeseqsfile.txt'] - keepseqs = ['Panu', 'Ggor'] - -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqstest_purgeseqsfile_keepseqsPanuGgor.pdf -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqstest_purgeseqsfile_keepseqsPanuGgor.fasta -There are 2 sequences specified by --keepseqs -Read 1 sequences from the --purgeseqs file /home/shilton/phydms/tests/prepalignment_tests/test_purgeseqsfile.txt -Read 67 sequences from /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta -Retained 66 after removing those specified for purging by '--purgeseqs.' -Retained 66 sequences after removing any with length not multiple of 3. -Retained 61 sequences after purging any with ambiguous nucleotides. -Retained 61 sequences after purging any with premature stops or that are otherwise un-translateable. -Using the following as reference sequence: ENSP00000376077_Hsap/1-303 -Purged sequences encoding redundant proteins, being sure to retain reference sequence and any specified by '--keepseqs'. Overall, 55 sequences remain. -You specified '--prealigned', so the sequences are NOT being aligned. -After stripping gaps relative to reference sequence, all proteins are of length 101 -Retained 49 sequences after purging those with < 0.7 protein identity to reference sequence. -Retained 33 sequences after purging those without at least 2 amino-acid differences with other retained sequences. -Writing the final alignment of 33 coding sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqstest_purgeseqsfile_keepseqsPanuGgor.fasta -Plotting retained and purged sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqstest_purgeseqsfile_keepseqsPanuGgor.pdf - -Successful completion of phydms_prepalignment - -Beginning execution of phydms_prepalignment in directory /home/shilton/phydms/tests at time Thu May 24 08:58:39 2018 - -Version information: - Time and date: Thu May 24 08:58:39 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -Parsed the following command-line arguments: - inseqs = /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta - alignment = /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqsFcat_keepseqstest_keepseqsfile.fasta - refseq = Hsap - prealigned = True - mafft = mafft - minidentity = 0.7 - minuniqueness = 2 - purgeseqs = ['Fcat'] - keepseqs = ['/home/shilton/phydms/tests/prepalignment_tests/test_keepseqsfile.txt'] - -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqsFcat_keepseqstest_keepseqsfile.pdf -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqsFcat_keepseqstest_keepseqsfile.fasta -Read 2 sequences from the --keepseqs file /home/shilton/phydms/tests/prepalignment_tests/test_keepseqsfile.txt -There are 1 sequences specified by --purgeseqs -Read 67 sequences from /home/shilton/phydms/tests/prepalignment_tests/prealigned_SUMO1_orthologs.fasta -Retained 66 after removing those specified for purging by '--purgeseqs.' -Retained 66 sequences after removing any with length not multiple of 3. -Retained 61 sequences after purging any with ambiguous nucleotides. -Retained 61 sequences after purging any with premature stops or that are otherwise un-translateable. -Using the following as reference sequence: ENSP00000376077_Hsap/1-303 -Purged sequences encoding redundant proteins, being sure to retain reference sequence and any specified by '--keepseqs'. Overall, 55 sequences remain. -You specified '--prealigned', so the sequences are NOT being aligned. -After stripping gaps relative to reference sequence, all proteins are of length 101 -Retained 49 sequences after purging those with < 0.7 protein identity to reference sequence. -Retained 33 sequences after purging those without at least 2 amino-acid differences with other retained sequences. -Writing the final alignment of 33 coding sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqsFcat_keepseqstest_keepseqsfile.fasta -Plotting retained and purged sequences to /home/shilton/phydms/tests/prepalignment_tests/test_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqsFcat_keepseqstest_keepseqsfile.pdf - -Successful completion of phydms_prepalignment - -Beginning execution of phydms_prepalignment in directory /home/shilton/phydms/tests at time Thu May 24 08:58:43 2018 - -Version information: - Time and date: Thu May 24 08:58:43 2018 - Platform: Linux-3.13.0-143-generic-x86_64-with-debian-jessie-sid - Python version: 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] - phydms version: 2.2.2 - Bio version: 1.69 - cython version: 0.25.2 - numpy version: 1.14.0 - scipy version: 1.0.0 - matplotlib version: 2.2.2 - natsort version: 5.2.0 - sympy version: 1.0 - six version: 1.11.0 - pandas version: 0.21.0 - pyvolve version: 0.8.4 - statsmodels version: 0.8.0 - weblogolib version: 3.5.0 - PyPDF2 version: 1.26.0 - -Parsed the following command-line arguments: - inseqs = /home/shilton/phydms/tests/prepalignment_tests/unaligned_SUMO1_orthologs.fasta - alignment = /home/shilton/phydms/tests/prepalignment_tests/test_unaligned_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqs.fasta - refseq = Hsap - prealigned = False - mafft = mafft - minidentity = 0.7 - minuniqueness = 2 - purgeseqs = [''] - keepseqs = [''] - -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_unaligned_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqs.pdf -Removing existing output file /home/shilton/phydms/tests/prepalignment_tests/test_unaligned_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqs.fasta -There are 0 sequences specified by --keepseqs -There are 0 sequences specified by --purgeseqs -Read 67 sequences from /home/shilton/phydms/tests/prepalignment_tests/unaligned_SUMO1_orthologs.fasta -Retained 67 after removing those specified for purging by '--purgeseqs.' -Retained 67 sequences after removing any with length not multiple of 3. -Retained 62 sequences after purging any with ambiguous nucleotides. -Retained 62 sequences after purging any with premature stops or that are otherwise un-translateable. -Using the following as reference sequence: ENSP00000376077_Hsap/1-303 -Purged sequences encoding redundant proteins, being sure to retain reference sequence and any specified by '--keepseqs'. Overall, 54 sequences remain. -Aligning sequences with MAFFT using mafft b'v7.305b (2016/Aug/16)' -After stripping gaps relative to reference sequence, all proteins are of length 101 -Retained 49 sequences after purging those with < 0.7 protein identity to reference sequence. -Retained 33 sequences after purging those without at least 2 amino-acid differences with other retained sequences. -Writing the final alignment of 33 coding sequences to /home/shilton/phydms/tests/prepalignment_tests/test_unaligned_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqs.fasta -Plotting retained and purged sequences to /home/shilton/phydms/tests/prepalignment_tests/test_unaligned_SUMO1_alignment_minidentity0.7_minuniqueness2_purgeseqs_keepseqs.pdf - -Successful completion of phydms_prepalignment -/home/shilton/phydms/tests/logoplot_test_results/diffprefs_logoplot.pdf diff --git a/tests/run_time_test.py b/tests/run_time_test.py deleted file mode 100644 index 650ff8fb..00000000 --- a/tests/run_time_test.py +++ /dev/null @@ -1,43 +0,0 @@ -"""Runs all tests.""" - - -import os -import sys -import glob -import unittest -import pandas as pd -import time - -def main(): - """Runs the tests.""" - r = {"test":[], "time":[]} - failurestrings = [] - for test in glob.glob('test_*.py'): - s = time.time() - sys.stderr.write('\nRunning tests in {0}...\n'.format(test)) - test = os.path.splitext(test)[0] - suite = unittest.TestLoader().loadTestsFromName(test) - result = unittest.TestResult() - suite.run(result) - e = time.time() - if result.wasSuccessful(): - sys.stderr.write('All tests were successful.\n') - r["test"].append(test) - r["time"].append(float(e-s)/60) - else: - sys.stderr.write('Test(s) FAILED!\n') - for (testcase, failstring) in result.failures + result.errors: - failurestrings.append(failstring) - - if not failurestrings: - sys.stderr.write('\nTesting complete. All passed successfully.\n') - else: - sys.stderr.write('\nTesting complete. Failed on the following:\n') - for fstring in failurestrings: - sys.stderr.write('\n*********\n{0}\n********\n'.format(fstring)) - r = pd.DataFrame(r) - r["Greater_10min"] = ["y" if x>10 else "n" for x in r["time"]] - r.to_csv("time_test_results.csv", index=False) - -if __name__ == '__main__': - main() diff --git a/tests/test_alignmentSimulation.py b/tests/test_alignmentSimulation.py index 1b4028d3..09e6e63a 100644 --- a/tests/test_alignmentSimulation.py +++ b/tests/test_alignmentSimulation.py @@ -7,7 +7,6 @@ import os import sys -import numpy import scipy import math import unittest @@ -23,27 +22,21 @@ import pyvolve - class test_simulateAlignment_ExpCM(unittest.TestCase): - """Tests `simulateAlignment` of `simulate.py` module.""" + """Tests simulating an alignment using both `pyvolve` and `Simulator`""" # 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_simulateAlignment(self): - """Simulate evolution, ensure scaled branches match number of subs.""" - + def setUp(self): + """Set up parameters for test.""" scipy.random.seed(1) - random.seed(1) - - alignmentPrefix = "test" - # define model - nsites = 1000 + self.nsites = 350 prefs = [] minpref = 0.01 - for r in range(nsites): + for r in range(self.nsites): rprefs = scipy.random.dirichlet([1] * N_AA) rprefs[rprefs < minpref] = minpref rprefs /= rprefs.sum() @@ -54,66 +47,92 @@ def test_simulateAlignment(self): mu = 0.3 if self.MODEL == phydmslib.models.ExpCM: phi = scipy.random.dirichlet([7] * N_NT) - model = phydmslib.models.ExpCM(prefs, kappa=kappa, omega=omega, - beta=beta, mu=mu, phi=phi, freeparams=['mu']) + self.model = phydmslib.models.ExpCM(prefs, kappa=kappa, omega=omega, + beta=beta, mu=mu, phi=phi, + freeparams=['mu']) elif self.MODEL == phydmslib.models.ExpCM_empirical_phi: g = scipy.random.dirichlet([7] * N_NT) - model = phydmslib.models.ExpCM_empirical_phi(prefs, g, - kappa=kappa, omega=omega, beta=beta, mu=mu, - freeparams=['mu']) + self.model = phydmslib.models.ExpCM_empirical_phi(prefs, g, + kappa=kappa, + omega=omega, + beta=beta, + mu=mu, + freeparams=['mu']) elif self.MODEL == phydmslib.models.YNGKP_M0: - e_pw = numpy.asarray([scipy.random.dirichlet([7] * N_NT) for i - in range(3)]) - model = phydmslib.models.YNGKP_M0(e_pw, nsites) + e_pw = scipy.asarray([scipy.random.dirichlet([7] * N_NT) for i + in range(3)]) + self.model = phydmslib.models.YNGKP_M0(e_pw, self.nsites) else: raise ValueError("Invalid MODEL: {0}".format(type(self.MODEL))) # make a test tree # tree is two sequences separated by a single branch # the units are in sub/site - t = 0.04 - newicktree = '(tip1:{0},tip2:{0});'.format(t / 2.0) - temptree = '_temp.tree' - with open(temptree, 'w') as f: + self.t = 0.04 + newicktree = '(tip1:{0},tip2:{0});'.format(self.t / 2.0) + self.tree_fname = '_temp.tree' + with open(self.tree_fname, 'w') as f: f.write(newicktree) + self.tree = Bio.Phylo.read(self.tree_fname, 'newick') - # simulate the alignment - phydmslib.simulate.simulateAlignment(model, temptree, alignmentPrefix) - - # read in the test tree, re-scale the branch lengths, and remove the file - biotree = Bio.Phylo.read(temptree, 'newick') - os.remove(temptree) - for node in biotree.get_terminals() + biotree.get_nonterminals(): + self.rescaled_tree = copy.deepcopy(self.tree) + # re-scale the branch lengths + for node in self.rescaled_tree.get_terminals() + self.rescaled_tree.get_nonterminals(): if node.branch_length: - node.branch_length /= model.branchScale + node.branch_length /= self.model.branchScale + + def test_simulateAlignment_Simulator(self): + """Simulate evolution with the `Simulator` class. + Ensures scaled branches match number of subs. + """ + simulator = phydmslib.simulate.Simulator(self.tree, self.model) + alignment = simulator.simulate(1) + self.check_alignment(alignment) + + def test_simulateAlignment_pyvolve(self): + """Simulate evolution with `pyvolve` class. + Ensures scaled branches match number of subs. + """ + + # simulate the alignment using `pyvlove` + alignment = phydmslib.simulate.simulateAlignment(self.model, + self.tree_fname, + "{0}_pyvolve".format("test"), + randomSeed=1) + os.remove(self.tree_fname) + assert len(alignment) == 1, "Only expected one `pyvolve` alignment" + a = [(s.description, str(s.seq)) for s in Bio.SeqIO.parse( + alignment[0], 'fasta')] + self.check_alignment(a) + if os.path.isfile(alignment[0]): + os.remove(alignment[0]) + + def check_alignment(self, a): + scipy.random.seed(1) # check and see if the simulated alignment has the expected number of # subs exists - alignment = '{0}_simulatedalignment.fasta'.format(alignmentPrefix) - nsubs = 0 # subs in simulated seqs (estimate from Hamming distance) - treedist = 0.0 # distance inferred by `TreeLikelihood` - a = [(s.description, str(s.seq)) for s in Bio.SeqIO.parse( - alignment, 'fasta')] - assert len(a[0][1]) == len(a[1][1]) == nsites * 3 - for f in [alignment]: - if os.path.isfile(f): - os.remove(f) - for r in range(nsites): - codon1 = a[0][1][3 * r : 3 * r + 3] - codon2 = a[1][1][3 * r : 3 * r + 3] + nsubs = 0 # subs in simulated seqs (estimate from Hamming distance) + treedist = 0.0 # distance inferred by `TreeLikelihood` + assert len(a[0][1]) == len(a[1][1]) == self.nsites * 3 + for r in range(self.nsites): + codon1 = a[0][1][3 * r: 3 * r + 3] + codon2 = a[1][1][3 * r: 3 * r + 3] nsubs += len([j for j in range(3) if codon1[j] != codon2[j]]) - nsubs /= float(nsites) - tl = phydmslib.treelikelihood.TreeLikelihood(biotree, a, model) + nsubs /= float(self.nsites) + tl = phydmslib.treelikelihood.TreeLikelihood(self.rescaled_tree, + a, self.model) tl.maximizeLikelihood() treedist += sum([n.branch_length for n in tl.tree.get_terminals()]) # We expect nsubs = t, but build in some tolerance # with rtol since we simulated finite number of sites. - self.assertTrue(numpy.allclose(nsubs, t, rtol=0.2), - ("Simulated subs per site of {0} is not close " - "to expected value of {1} (branchScale = {2}, t = {3})").format( - nsubs, t, model.branchScale, t)) - self.assertTrue(numpy.allclose(treedist, nsubs, rtol=0.2), ( + self.assertTrue(scipy.allclose(nsubs, self.t, rtol=0.2), + ("Simulated subs per site of {0} is not close " + "to expected value of {1} (branchScale = {2}," + " t = {3})").format( + nsubs, self.t, self.model.branchScale, self.t)) + self.assertTrue(scipy.allclose(treedist, nsubs, rtol=0.2), ( "Simulated subs per site of {0} is not close to inferred " "branch length of {1}").format(nsubs, treedist)) diff --git a/tests/test_alignmentSimulationRandomSeed.py b/tests/test_alignmentSimulationRandomSeed.py index b26679f5..dee9eb88 100644 --- a/tests/test_alignmentSimulationRandomSeed.py +++ b/tests/test_alignmentSimulationRandomSeed.py @@ -7,7 +7,6 @@ import os import sys -import numpy import scipy import math import unittest @@ -32,17 +31,13 @@ class test_simulateAlignmentRandomSeed_ExpCM(unittest.TestCase): # http://stackoverflow.com/questions/17260469/instantiate-python-unittest-testcase-with-arguments MODEL = phydmslib.models.ExpCM_empirical_phi - def test_simulateAlignmentRandomSeed(self): - """Simulate evolution, ensure scaled branches match number of subs.""" - - scipy.random.seed(1) - random.seed(1) - + def setUp(self): + """Set up parameters for test.""" # define model - nsites = 200 + self.nsites = 5 prefs = [] minpref = 0.01 - for r in range(nsites): + for r in range(self.nsites): rprefs = scipy.random.dirichlet([1] * N_AA) rprefs[rprefs < minpref] = minpref rprefs /= rprefs.sum() @@ -53,28 +48,36 @@ def test_simulateAlignmentRandomSeed(self): mu = 0.3 if self.MODEL == phydmslib.models.ExpCM: phi = scipy.random.dirichlet([7] * N_NT) - model = phydmslib.models.ExpCM(prefs, kappa=kappa, omega=omega, - beta=beta, mu=mu, phi=phi, freeparams=['mu']) + self.model = phydmslib.models.ExpCM(prefs, kappa=kappa, omega=omega, + beta=beta, mu=mu, phi=phi, + freeparams=['mu']) elif self.MODEL == phydmslib.models.ExpCM_empirical_phi: g = scipy.random.dirichlet([7] * N_NT) - model = phydmslib.models.ExpCM_empirical_phi(prefs, g, - kappa=kappa, omega=omega, beta=beta, mu=mu, - freeparams=['mu']) + self.model = phydmslib.models.ExpCM_empirical_phi(prefs, g, + kappa=kappa, + omega=omega, + beta=beta, + mu=mu, + freeparams=['mu']) elif self.MODEL == phydmslib.models.YNGKP_M0: - e_pw = numpy.asarray([scipy.random.dirichlet([7] * N_NT) for i - in range(3)]) - model = phydmslib.models.YNGKP_M0(e_pw, nsites) + e_pw = scipy.asarray([scipy.random.dirichlet([7] * N_NT) for i + in range(3)]) + self.model = phydmslib.models.YNGKP_M0(e_pw, self.nsites) else: raise ValueError("Invalid MODEL: {0}".format(type(self.MODEL))) # make a test tree # tree is two sequences separated by a single branch - t = 0.04 / model.branchScale - newicktree = '(tip1:{0},tip2:{0});'.format(t / 2.0) - temptree = '_temp.tree' - with open(temptree, 'w') as f: + # the units are in sub/site + self.t = 0.04 + newicktree = '(tip1:{0},tip2:{0});'.format(self.t / 2.0) + self.tree_fname = '_temp.tree' + with open(self.tree_fname, 'w') as f: f.write(newicktree) + self.tree = Bio.Phylo.read(self.tree_fname, 'newick') + def test_pyvovle_randomSeed(self): + """Simulate evolution, ensure scaled branches match number of subs.""" counter = 0 seed = 1 alignments = [{}, {}, {}] @@ -82,7 +85,7 @@ def test_simulateAlignmentRandomSeed(self): # make two alignments with the same seed number for counter in range(2): alignmentPrefix = "test_counter{0}_seed{1}".format(counter,seed) - phydmslib.simulate.simulateAlignment(model, temptree, alignmentPrefix, seed) + phydmslib.simulate.simulateAlignment(self.model, self.tree_fname, alignmentPrefix, seed) for s in Bio.SeqIO.parse("test_counter{0}_seed{1}_simulatedalignment.fasta".format(counter,seed), "fasta"): alignments[counter][s.id] = str(s.seq) # check they are the same @@ -94,20 +97,60 @@ def test_simulateAlignmentRandomSeed(self): seed += 1 counter += 1 alignmentPrefix = "test_counter{0}_seed{1}".format(counter,seed) - phydmslib.simulate.simulateAlignment(model, temptree, alignmentPrefix, seed) + phydmslib.simulate.simulateAlignment(self.model, self.tree_fname, alignmentPrefix, seed) for s in Bio.SeqIO.parse("test_counter{0}_seed{1}_simulatedalignment.fasta".format(counter,seed), "fasta"): alignments[counter][s.id] = str(s.seq) # check they are different for key in alignments[counter].keys(): self.assertFalse(alignments[counter][key] == alignments[counter - 1][key]) - # general clean-up - os.remove(temptree) + os.remove(self.tree_fname) for fasta in glob.glob("test*simulatedalignment.fasta"): if os.path.isfile(fasta): os.remove(fasta) + def test_simulator_randomSeed(self): + """Simulate evolution with the `Simulator` class. + Ensures scaled branches match number of subs. + """ + seed = 1 + alignments = [] + simulator = phydmslib.simulate.Simulator(self.tree, self.model) + for i in range(2): + alignments.append(dict(simulator.simulate(seed))) + alignments.append(dict(simulator.simulate(seed+1))) + + # check that the first two alignments are the same and the last + # is different. + for key in alignments[0].keys(): + self.assertTrue(alignments[0][key] == alignments[1][key]) + self.assertFalse(alignments[0][key] == alignments[2][key]) + + def test_simulator_randomSeed_outside(self): + """Simulate evolution with the `Simulator` class. + Sets seed before calling `simulate`. + Ensures scaled branches match number of subs. + """ + seed = 1 + alignments = [] + simulator = phydmslib.simulate.Simulator(self.tree, self.model) + + scipy.random.seed(seed) + for i in range(2): + alignments.append(dict(simulator.simulate())) + + scipy.random.seed(seed) + for i in range(2): + alignments.append(dict(simulator.simulate())) + + # check that the first/third and second/fourth are the same + # check that the first and second are different + for key in alignments[0].keys(): + self.assertTrue(alignments[0][key] == alignments[2][key]) + self.assertTrue(alignments[1][key] == alignments[3][key]) + self.assertFalse(alignments[0][key] == alignments[1][key]) + class test_simulateAlignmentRandomSeed_YNGKP_M0(test_simulateAlignmentRandomSeed_ExpCM): """Tests `simulateAlignment` of `YNGKP_M0` model.""" diff --git a/tests/test_alignmentSimulationReplicates.py b/tests/test_alignmentSimulationReplicates.py new file mode 100644 index 00000000..da54c9b1 --- /dev/null +++ b/tests/test_alignmentSimulationReplicates.py @@ -0,0 +1,124 @@ +"""Tests replicate simulations in aligment simulation. + +Makes sure the replicate simulated alignments are different. + +Written by Sarah Hilton and Jesse Bloom. +""" + +import os +import sys +import scipy +import math +import unittest +import random +import io +import copy +import phydmslib.models +import phydmslib.treelikelihood +import phydmslib.simulate +from phydmslib.constants import * +import Bio.SeqIO +import Bio.Phylo +import pyvolve +import glob + + +class test_simulateAlignmentReplicate_ExpCM(unittest.TestCase): + """Tests replicate functionality of `simulate.simulateAlignment`""" + + # 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_simulateAlignmentRandomSeed(self): + """Simulate evolution, ensure replicats are different.""" + + scipy.random.seed(1) + random.seed(1) + + # define model + nsites = 5 + prefs = [] + minpref = 0.01 + for r in range(nsites): + rprefs = scipy.random.dirichlet([1] * N_AA) + rprefs[rprefs < minpref] = minpref + rprefs /= rprefs.sum() + prefs.append(dict(zip(sorted(AA_TO_INDEX.keys()), rprefs))) + kappa = 4.2 + omega = 0.4 + beta = 1.5 + mu = 0.3 + if self.MODEL == phydmslib.models.ExpCM: + phi = scipy.random.dirichlet([7] * N_NT) + model = phydmslib.models.ExpCM(prefs, kappa=kappa, omega=omega, + beta=beta, mu=mu, phi=phi, + freeparams=['mu']) + elif self.MODEL == phydmslib.models.ExpCM_empirical_phi: + g = scipy.random.dirichlet([7] * N_NT) + model = phydmslib.models.ExpCM_empirical_phi(prefs, g, kappa=kappa, + omega=omega, + beta=beta, mu=mu, + freeparams=['mu']) + elif self.MODEL == phydmslib.models.YNGKP_M0: + e_pw = scipy.asarray([scipy.random.dirichlet([7] * N_NT) for i + in range(3)]) + model = phydmslib.models.YNGKP_M0(e_pw, nsites) + else: + raise ValueError("Invalid MODEL: {0}".format(type(self.MODEL))) + + # make a test tree (two sequences separated by one branch) + t = 0.04 / model.branchScale + newicktree = '(tip1:{0},tip2:{0});'.format(t / 2.0) + temptree = '_temp.tree' + with open(temptree, 'w') as f: + f.write(newicktree) + + nSim = 2 + seeds = [1, 1, 2] # the first two runs should the the same + alignments = [[{} for x in range(nSim)] for x in range(len(seeds))] + for i, seed in enumerate(seeds): + alignmentPrefix = "_test" + final = ["{0}_{1}_simulatedalignment.fasta" + .format(alignmentPrefix, i) for i in range(nSim)] + phydmslib.simulate.simulateAlignment(model, temptree, + alignmentPrefix, seed, nSim) + for rep in range(nSim): + for s in Bio.SeqIO.parse("_test_{0}_simulatedalignment.fasta" + .format(rep), "fasta"): + alignments[i][rep][s.id] = str(s.seq) + # clean-up + for fasta in final: + if os.path.isfile(fasta): + os.remove(fasta) + os.remove(temptree) + + # sequence names + seq_names = list(alignments[1][0].keys()) + + # Within each run, the alignments should be different + for i, seed in enumerate(seeds): + run = alignments[i] + for key in seq_names: + seqs = [run[rep][key] for rep in range(nSim)] + # all sequences should be different + self.assertTrue(len(seqs) == len(set(seqs))) + + # The first two alignments should be the same, the third different + for rep in range(nSim): + for key in seq_names: + seq1 = alignments[0][rep][key] + seq2 = alignments[1][rep][key] + seq3 = alignments[2][rep][key] + self.assertTrue(seq1 == seq2) # first two the same + self.assertFalse(seq1 == seq3) # third different + + +class test_simulateAlignmentReplicate_YNGKP_M0(test_simulateAlignmentReplicate_ExpCM): + """Tests `simulateAlignment` of `YNGKP_M0` model.""" + MODEL = phydmslib.models.YNGKP_M0 + + +if __name__ == '__main__': + runner = unittest.TextTestRunner() + unittest.main(testRunner=runner) diff --git a/tests/test_alignmentSimulation_divpressure.py b/tests/test_alignmentSimulation_divpressure.py index fb3bef1f..d83b5d13 100644 --- a/tests/test_alignmentSimulation_divpressure.py +++ b/tests/test_alignmentSimulation_divpressure.py @@ -41,7 +41,7 @@ def test_simulateAlignment(self): alignmentPrefix = "test" # define model - nsites = 1000 + nsites = 350 prefs = [] minpref = 0.01 for r in range(nsites): diff --git a/tests/test_branchScale.py b/tests/test_branchScale.py index 17b297b1..6a82a03c 100644 --- a/tests/test_branchScale.py +++ b/tests/test_branchScale.py @@ -39,7 +39,7 @@ def test_branchScale(self): random.seed(1) # define model, only free parameter is mu for testing simulations - nsites = 50 + nsites = 10 prefs = [] minpref = 0.01 for r in range(nsites): @@ -63,7 +63,7 @@ def test_branchScale(self): freeparams=['mu']) partitions = phydmslib.simulate.pyvolvePartitions(model) elif self.MODEL == phydmslib.models.YNGKP_M0: - e_pw = numpy.asarray([scipy.random.dirichlet([7] * N_NT) for i + e_pw = numpy.asarray([scipy.random.dirichlet([7] * N_NT) for i in range(3)]) model = phydmslib.models.YNGKP_M0(e_pw, nsites) partitions = phydmslib.simulate.pyvolvePartitions(model) @@ -81,7 +81,7 @@ def test_branchScale(self): os.remove(temptree) # Simulate evolution of two sequences separated by a long branch. - # Then estimate subs per site in a heuristic way that will be + # Then estimate subs per site in a heuristic way that will be # roughly correct for short branches. Do this all several times # and average results to get better accuracy. alignment = '_temp_branchScale_simulatedalignment.fasta' diff --git a/tests/test_brlenderivatives.py b/tests/test_brlenderivatives.py index 747233e5..c31c4ccf 100644 --- a/tests/test_brlenderivatives.py +++ b/tests/test_brlenderivatives.py @@ -36,7 +36,7 @@ def setUp(self): self.underflowfreq = 1 - # define tree + # define tree self.newick = ('((node1:0.2,node2:0.3)node4:0.3,node3:0.5)node5:0.04;') tempfile = '_temp.tree' with open(tempfile, 'w') as f: @@ -46,7 +46,7 @@ def setUp(self): # simulate alignment with pyvolve pyvolvetree = pyvolve.read_tree(tree=self.newick) - self.nsites = 50 + self.nsites = 5 self.nseqs = self.tree.count_terminals() e_pw = scipy.ndarray((3, N_NT), dtype='float') e_pw.fill(0.25) @@ -91,7 +91,7 @@ def setUp(self): if self.DISTRIBUTIONMODEL is None: pass - elif (self.DISTRIBUTIONMODEL == + elif (self.DISTRIBUTIONMODEL == phydmslib.models.GammaDistributedOmegaModel): self.model = self.DISTRIBUTIONMODEL(self.model, ncats=4) else: @@ -100,7 +100,7 @@ def setUp(self): def test_Initialize(self): """Test that `TreeLikelihood` initializes properly.""" - tl = phydmslib.treelikelihood.TreeLikelihood(self.tree, + tl = phydmslib.treelikelihood.TreeLikelihood(self.tree, self.alignment, self.model, underflowfreq=self.underflowfreq, dparamscurrent=False, dtcurrent=True) self.assertEqual(tl.dloglik_dt.shape, tl.t.shape) @@ -109,7 +109,7 @@ def test_dM_dt(self): """Tests model `dM` with respect to `t`.""" scipy.random.seed(1) random.seed(1) - tl = phydmslib.treelikelihood.TreeLikelihood(self.tree, + tl = phydmslib.treelikelihood.TreeLikelihood(self.tree, self.alignment, self.model, underflowfreq=self.underflowfreq, dparamscurrent=False, dtcurrent=True) @@ -130,7 +130,7 @@ def dfunc(t, k, r, x, y): def test_AdjustBrLen(self): """Tests adjusting branch lengths.""" scipy.random.seed(1) - tl = phydmslib.treelikelihood.TreeLikelihood(self.tree, + tl = phydmslib.treelikelihood.TreeLikelihood(self.tree, self.alignment, self.model, underflowfreq=self.underflowfreq, dparamscurrent=False, dtcurrent=True) loglik1 = tl.loglik @@ -152,7 +152,7 @@ def test_AdjustBrLen(self): def test_BrLenDerivatives(self): """Tests derivatives of branch lengths.""" - tl = phydmslib.treelikelihood.TreeLikelihood(self.tree, + tl = phydmslib.treelikelihood.TreeLikelihood(self.tree, self.alignment, self.model, underflowfreq=self.underflowfreq, dparamscurrent=False, dtcurrent=True) @@ -169,18 +169,18 @@ def dfunc(t, n): return tl.dloglik_dt[n] for n in range(len(tl.t)): - diff = scipy.optimize.check_grad(func, dfunc, + diff = scipy.optimize.check_grad(func, dfunc, numpy.array([tl.t[n]]), n) self.assertTrue(diff < 2e-5, diff) def test_dtcurrent(self): """Tests use of `dtcurrent` attribute.""" - tl1 = phydmslib.treelikelihood.TreeLikelihood(self.tree, + tl1 = phydmslib.treelikelihood.TreeLikelihood(self.tree, self.alignment, self.model, underflowfreq=self.underflowfreq, dparamscurrent=False, dtcurrent=True) - tl2 = phydmslib.treelikelihood.TreeLikelihood(self.tree, + tl2 = phydmslib.treelikelihood.TreeLikelihood(self.tree, self.alignment, self.model, underflowfreq=self.underflowfreq, dparamscurrent=True, dtcurrent=False) diff --git a/tests/test_brlenoptimize.py b/tests/test_brlenoptimize.py index 09ba90c9..d2c5c78d 100644 --- a/tests/test_brlenoptimize.py +++ b/tests/test_brlenoptimize.py @@ -35,7 +35,7 @@ def setUp(self): self.underflowfreq = 1 - # define tree + # define tree self.newick = ('((node1:0.2,node2:0.3)node4:0.3,node3:0.5)node5:0.04;') tempfile = '_temp.tree' with open(tempfile, 'w') as f: @@ -44,7 +44,7 @@ def setUp(self): os.remove(tempfile) # amino-acid preferences - self.nsites = 50 + self.nsites = 5 prefs = [] minpref = 0.02 g = scipy.random.dirichlet([5] * N_NT) @@ -78,7 +78,7 @@ def setUp(self): raise ValueError("Invalid MODEL: {0}".format(self.MODEL)) if self.DISTRIBUTIONMODEL is None: pass - elif (self.DISTRIBUTIONMODEL == + elif (self.DISTRIBUTIONMODEL == phydmslib.models.GammaDistributedOmegaModel): self.model = self.DISTRIBUTIONMODEL(self.model, ncats=4) else: @@ -87,11 +87,11 @@ def setUp(self): def test_Optimize(self): """Tests optimization of branch lengths.""" - tl = phydmslib.treelikelihood.TreeLikelihood(self.tree, + tl = phydmslib.treelikelihood.TreeLikelihood(self.tree, self.alignment, self.model, underflowfreq=self.underflowfreq) maxresult = tl.maximizeLikelihood(optimize_brlen=True) - tl2 = phydmslib.treelikelihood.TreeLikelihood(self.tree, + tl2 = phydmslib.treelikelihood.TreeLikelihood(self.tree, self.alignment, self.model, underflowfreq=self.underflowfreq) maxresult = tl.maximizeLikelihood(optimize_brlen=False) diff --git a/tests/test_compare_pyvolve_simulator.py b/tests/test_compare_pyvolve_simulator.py new file mode 100644 index 00000000..a44cf314 --- /dev/null +++ b/tests/test_compare_pyvolve_simulator.py @@ -0,0 +1,235 @@ +"""Tests whether or not `pyvolve` and `Simulator` give similar results. + +Makes sure `pyvolve` and `Simulator` give similar distributions of +alignment summary statistics. + +Written by Sarah Hilton and Jesse Bloom. +""" + +import os +import sys +import scipy +import math +import unittest +import random +import io +import copy +import phydmslib.models +import phydmslib.treelikelihood +import phydmslib.simulate +from phydmslib.constants import * +from phydmslib.file_io import ReadCodonAlignment +import Bio.SeqIO +import Bio.Phylo +import pyvolve +import itertools +from scipy.special import comb +from scipy.stats import entropy +import pandas as pd + + +class test_compare_ExpCM(unittest.TestCase): + """Tests `pyvolve` and `Simulator` on `ExpCM`""" + + # 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 setUp(self): + """Set up model, tree, and simulate alignments.""" + scipy.random.seed(1) + # number of simulation replicates + self.nsim = 100 + # define model + self.nsites = 10 + prefs = [] + minpref = 0.01 + for r in range(self.nsites): + rprefs = scipy.random.dirichlet([1] * N_AA) + rprefs[rprefs < minpref] = minpref + rprefs /= rprefs.sum() + prefs.append(dict(zip(sorted(AA_TO_INDEX.keys()), rprefs))) + kappa = 4.2 + omega = 0.4 + beta = 1.5 + mu = 0.3 + if self.MODEL == phydmslib.models.ExpCM: + phi = scipy.random.dirichlet([7] * N_NT) + self.model = phydmslib.models.ExpCM(prefs, kappa=kappa, omega=omega, + beta=beta, mu=mu, phi=phi, + freeparams=['mu']) + elif self.MODEL == phydmslib.models.ExpCM_empirical_phi: + g = scipy.random.dirichlet([7] * N_NT) + self.model = phydmslib.models.ExpCM_empirical_phi(prefs, g, + kappa=kappa, + omega=omega, + beta=beta, + mu=mu, + freeparams=['mu']) + elif self.MODEL == phydmslib.models.YNGKP_M0: + e_pw = scipy.asarray([scipy.random.dirichlet([7] * N_NT) for i + in range(3)]) + self.model = phydmslib.models.YNGKP_M0(e_pw, self.nsites) + else: + raise ValueError("Invalid MODEL: {0}".format(type(self.MODEL))) + + # make a test tree + # tree is two sequences separated by a single branch + # the units are in sub/site + self.t = 0.04 + newicktree = '(tip1:{0},tip2:{0});'.format(self.t / 2.0) + self.tree_fname = '_temp.tree' + with open(self.tree_fname, 'w') as f: + f.write(newicktree) + self.tree = Bio.Phylo.read(self.tree_fname, 'newick') + + self.rescaled_tree = copy.deepcopy(self.tree) + # re-scale the branch lengths + for node in self.rescaled_tree.get_terminals() + self.rescaled_tree.get_nonterminals(): + if node.branch_length: + node.branch_length /= self.model.branchScale + + # simulate `Simulator` alignments + self.simulator_alignments = [] + simulator = phydmslib.simulate.Simulator(self.tree, self.model) + for i in range(self.nsim): + self.simulator_alignments.append(simulator.simulate(i)) + # simulate `pyvovle` alignments + pyvolve_fname = phydmslib.simulate.simulateAlignment(self.model, + self.tree_fname, + "{0}_pyvolve".format("test"), + randomSeed=1, + nSim=self.nsim) + self.pyvolve_alignments = [ReadCodonAlignment(fname, checknewickvalid=True) + for fname in pyvolve_fname] + for fname in pyvolve_fname: + if os.path.isfile(fname): + os.remove(fname) + + def test_amino_acid_frequencies(self): + """Ensure average site-wise amino-acid frequences are similar.""" + simulator_aa_freqs = self.calc_AA_freqs(self.simulator_alignments) + pyvovlve_aa_freqs = self.calc_AA_freqs(self.pyvolve_alignments) + + # The tolerance is rather lenient because the tree is so small. + self.assertTrue(scipy.allclose(simulator_aa_freqs, + pyvovlve_aa_freqs, atol=1e-1)) + + def test_amino_acid_identity(self): + """Ensure pair-wise amino-acid identity is similar.""" + simulator_identity = self.calc_AA_identity(self.simulator_alignments) + pyvolve_identity = self.calc_AA_identity(self.pyvolve_alignments) + + self.assertTrue(scipy.allclose(simulator_identity, + pyvolve_identity, atol=1e-2)) + + def test_site_entropy(self): + """Ensure site-wise entropy is similar.""" + simulator_entropy = self.calc_site_entropy(self.simulator_alignments) + pyvolve_entropy = self.calc_site_entropy(self.simulator_alignments) + + self.assertTrue(scipy.allclose(simulator_entropy, pyvolve_entropy)) + + def calc_site_entropy(self, a): + """Calculate the average site-wise entropy.""" + # set up + amino_acids = list(INDEX_TO_AA.values()) + amino_acids.sort() + + site_entropy = [[] for x in range(self.nsites)] + temp = [self.calc_aa_frequencies(x)[amino_acids].values for x in a] + for sim in temp: + for i, site in enumerate(sim): + site_entropy[i].append(entropy(site)) + site_entropy = [scipy.average(scipy.array(x)) for x in site_entropy] + return scipy.array(site_entropy) + + def calc_AA_identity(self, a): + """Calculate average pairwise amino-acid identity.""" + final = [] + for sim in a: + aa_seq = [self.translate_with_gaps(seq[1]) for seq in sim] + for seq_pair in itertools.combinations(aa_seq, 2): + aa_id = [1 if seq_pair[0][i] == seq_pair[1][i] else 0 + for i in range(len(seq_pair[0]))] + aa_id = sum(aa_id) / len(aa_id) + final.append(aa_id) + final = sum(final) / len(final) + return final + + def calc_AA_freqs(self, a): + """Calculate average site-wise amino-acid frequencies.""" + # set up + amino_acids = list(INDEX_TO_AA.values()) + amino_acids.sort() + + aa_freqs = [[] for x in range(self.nsites)] + temp = [self.calc_aa_frequencies(x)[amino_acids].values for x in a] + for sim in temp: + for i, site in enumerate(sim): + aa_freqs[i].append(site) + aa_freqs = scipy.array([scipy.average(scipy.array(x), axis=0) + for x in aa_freqs]) + for site in aa_freqs: + assert scipy.allclose(scipy.sum(site), 1.0) + return aa_freqs + + def tearDown(self): + """Remove some files made by `pyvolve`.""" + for f in ['custom_matrix_frequencies.txt']: + if os.path.isfile(f): + os.remove(f) + os.remove(self.tree_fname) + + def translate_with_gaps(self, seq): + new_seq = [] + for i in range(len(seq) // 3): + codon = seq[3 * i : 3 * i + 3] + if codon == '---': + new_seq.append("-") + else: + new_seq.append(CODONSTR_TO_AASTR[codon]) + return("".join(new_seq)) + + def calc_aa_frequencies(self, alignment): + """Calculate amino-acid frequencies from a codon alignment.""" + # Read in the alignnment + assert scipy.all(scipy.array([len(s[1]) % 3 for s in alignment]) == 0),\ + "At least one sequence in the alignment is not a multiple of 3." + seqlength = len(alignment[0][1]) // 3 + df = {k: [0 for x in range(seqlength)] for k in list(INDEX_TO_AA.values())} + + # count amino acid frequencies + for seq in alignment: + for i in range(seqlength): + codon = seq[1][3 * i: 3 * i + 3] + if codon != '---': + df[CODONSTR_TO_AASTR[codon]][i] += 1 + df = pd.DataFrame(df) + + # Normalize the dataframe + assert not scipy.any(df.sum(axis=1) == 0), ("Attempting to normalize a " + "site by an amino acid count" + " of zero. Does the alignment" + " have an all gap column?") + df = df.div(df.sum(axis=1), axis=0) + assert scipy.allclose(df.sum(axis=1), 1, atol=0.005) + + # Final formatting + aa = [x for x in INDEX_TO_AA.values()] + aa.sort() # ABC order + final_cols = ["site"] + final_cols.extend(aa) + df["site"] = [x+1 for x in range(len(df))] + df = df[final_cols] + return df + + +class test_compare_YNGKP_M0(test_compare_ExpCM): + """Tests `pyvolve` and `Simulator` on `YNGKP_M0`.""" + MODEL = phydmslib.models.YNGKP_M0 + + +if __name__ == '__main__': + runner = unittest.TextTestRunner() + unittest.main(testRunner=runner) diff --git a/tests/test_compare_pyvolve_simulator_divpressure.py b/tests/test_compare_pyvolve_simulator_divpressure.py new file mode 100644 index 00000000..eeaa2668 --- /dev/null +++ b/tests/test_compare_pyvolve_simulator_divpressure.py @@ -0,0 +1,217 @@ +"""Tests whether or not `pyvolve` and `Simulator` give similar results. + +Makes sure `pyvolve` and `Simulator` give similar distributions of +alignment summary statistics, tested with the divpressure flag. + +Written by Sarah Hilton and Jesse Bloom. +""" + +import os +import sys +import scipy +import math +import unittest +import random +import io +import copy +import phydmslib.models +import phydmslib.treelikelihood +import phydmslib.simulate +from phydmslib.constants import * +from phydmslib.file_io import ReadCodonAlignment +import Bio.SeqIO +import Bio.Phylo +import pyvolve +import itertools +from scipy.special import comb +from scipy.stats import entropy +import pandas as pd + + +class test_compare_ExpCM(unittest.TestCase): + """Tests `pyvolve` and `Simulator` on `ExpCM`.""" + + # 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 + OMEGA_2 = 0.25 + + def setUp(self): + """Set up model, tree, and simulate alignments.""" + scipy.random.seed(1) + # number of simulation replicates + self.nsim = 100 + # define model + self.nsites = 10 + prefs = [] + minpref = 0.01 + for r in range(self.nsites): + rprefs = scipy.random.dirichlet([1] * N_AA) + rprefs[rprefs < minpref] = minpref + rprefs /= rprefs.sum() + prefs.append(dict(zip(sorted(AA_TO_INDEX.keys()), rprefs))) + kappa = 4.2 + omega = 0.4 + beta = 1.5 + mu = 0.3 + divpressure = scipy.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0]) + g = scipy.random.dirichlet([7] * N_NT) + self.model = phydmslib.models.ExpCM_empirical_phi_divpressure( + prefs, g, kappa=kappa, omega=omega, omega2=self.OMEGA_2, beta=beta, + mu=mu, divPressureValues=divpressure, freeparams=['mu']) + + # make a test tree + # tree is two sequences separated by a single branch + # the units are in sub/site + self.t = 0.04 + newicktree = '(tip1:{0},tip2:{0});'.format(self.t / 2.0) + self.tree_fname = '_temp.tree' + with open(self.tree_fname, 'w') as f: + f.write(newicktree) + self.tree = Bio.Phylo.read(self.tree_fname, 'newick') + + self.rescaled_tree = copy.deepcopy(self.tree) + # re-scale the branch lengths + for node in self.rescaled_tree.get_terminals() + \ + self.rescaled_tree.get_nonterminals(): + if node.branch_length: + node.branch_length /= self.model.branchScale + + # simulate `Simulator` alignments + self.simulator_alignments = [] + simulator = phydmslib.simulate.Simulator(self.tree, self.model) + for i in range(self.nsim): + self.simulator_alignments.append(simulator.simulate(i)) + # simulate `pyvovle` alignments + pyvolve_fname = phydmslib.simulate.simulateAlignment( + self.model, self.tree_fname, "{0}_pyvolve".format("test"), + randomSeed=1, nSim=self.nsim) + self.pyvolve_alignments = [ReadCodonAlignment(fname, + checknewickvalid=True) + for fname in pyvolve_fname] + for fname in pyvolve_fname: + if os.path.isfile(fname): + os.remove(fname) + + def test_amino_acid_frequencies(self): + """Ensure average site-wise amino-acid frequences are similar.""" + simulator_aa_freqs = self.calc_AA_freqs(self.simulator_alignments) + pyvovlve_aa_freqs = self.calc_AA_freqs(self.pyvolve_alignments) + + # The tolerance is rather lenient because the tree is so small. + self.assertTrue(scipy.allclose(simulator_aa_freqs, + pyvovlve_aa_freqs, atol=1e-1)) + + def test_amino_acid_identity(self): + """Ensure pair-wise amino-acid identity is similar.""" + simulator_identity = self.calc_AA_identity(self.simulator_alignments) + pyvolve_identity = self.calc_AA_identity(self.pyvolve_alignments) + + self.assertTrue(scipy.allclose(simulator_identity, + pyvolve_identity, atol=1e-2)) + + def test_site_entropy(self): + """Ensure site-wise entropy is similar.""" + simulator_entropy = self.calc_site_entropy(self.simulator_alignments) + pyvolve_entropy = self.calc_site_entropy(self.simulator_alignments) + + self.assertTrue(scipy.allclose(simulator_entropy, pyvolve_entropy)) + + def calc_site_entropy(self, a): + """Calculate the average site-wise entropy.""" + # set up + amino_acids = list(INDEX_TO_AA.values()) + amino_acids.sort() + + site_entropy = [[] for x in range(self.nsites)] + temp = [self.calc_aa_frequencies(x)[amino_acids].values for x in a] + for sim in temp: + for i, site in enumerate(sim): + site_entropy[i].append(entropy(site)) + site_entropy = [scipy.average(scipy.array(x)) for x in site_entropy] + return scipy.array(site_entropy) + + def calc_AA_identity(self, a): + """Calculate average pairwise amino-acid identity.""" + final = [] + for sim in a: + aa_seq = [self.translate_with_gaps(seq[1]) for seq in sim] + for seq_pair in itertools.combinations(aa_seq, 2): + aa_id = [1 if seq_pair[0][i] == seq_pair[1][i] else 0 + for i in range(len(seq_pair[0]))] + aa_id = sum(aa_id) / len(aa_id) + final.append(aa_id) + final = sum(final) / len(final) + return final + + def calc_AA_freqs(self, a): + """Calculate average site-wise amino-acid frequencies.""" + # set up + amino_acids = list(INDEX_TO_AA.values()) + amino_acids.sort() + + aa_freqs = [[] for x in range(self.nsites)] + temp = [self.calc_aa_frequencies(x)[amino_acids].values for x in a] + for sim in temp: + for i, site in enumerate(sim): + aa_freqs[i].append(site) + aa_freqs = scipy.array([scipy.average(scipy.array(x), axis=0) + for x in aa_freqs]) + for site in aa_freqs: + assert scipy.allclose(scipy.sum(site), 1.0) + return aa_freqs + + def tearDown(self): + """Remove some files made by `pyvolve`.""" + for f in ['custom_matrix_frequencies.txt']: + if os.path.isfile(f): + os.remove(f) + os.remove(self.tree_fname) + + def translate_with_gaps(self, seq): + new_seq = [] + for i in range(len(seq) // 3): + codon = seq[3 * i : 3 * i + 3] + if codon == '---': + new_seq.append("-") + else: + new_seq.append(CODONSTR_TO_AASTR[codon]) + return("".join(new_seq)) + + def calc_aa_frequencies(self, alignment): + """Calculate amino-acid frequencies from a codon alignment.""" + # Read in the alignnment + assert scipy.all(scipy.array([len(s[1]) % 3 for s in alignment]) == 0),\ + "At least one sequence in the alignment is not a multiple of 3." + seqlength = len(alignment[0][1]) // 3 + df = {k: [0 for x in range(seqlength)] for k in list(INDEX_TO_AA.values())} + + # count amino acid frequencies + for seq in alignment: + for i in range(seqlength): + codon = seq[1][3 * i: 3 * i + 3] + if codon != '---': + df[CODONSTR_TO_AASTR[codon]][i] += 1 + df = pd.DataFrame(df) + + # Normalize the dataframe + assert not scipy.any(df.sum(axis=1) == 0), ("Attempting to normalize a " + "site by an amino acid count" + " of zero. Does the alignment" + " have an all gap column?") + df = df.div(df.sum(axis=1), axis=0) + assert scipy.allclose(df.sum(axis=1), 1, atol=0.005) + + # Final formatting + aa = [x for x in INDEX_TO_AA.values()] + aa.sort() # ABC order + final_cols = ["site"] + final_cols.extend(aa) + df["site"] = [x+1 for x in range(len(df))] + df = df[final_cols] + return df + + +if __name__ == '__main__': + runner = unittest.TextTestRunner() + unittest.main(testRunner=runner) diff --git a/tests/test_diffprefsbysite.py b/tests/test_diffprefsbysite.py index 3f28ffd6..1e8b7e72 100644 --- a/tests/test_diffprefsbysite.py +++ b/tests/test_diffprefsbysite.py @@ -29,16 +29,12 @@ def setUp(self): random.seed(1) scipy.random.seed(1) self.tree = os.path.abspath(os.path.join(os.path.dirname(__file__), - './NP_data/NP_tree.newick')) - self.alignment = os.path.abspath(os.path.join(os.path.dirname(__file__), - './NP_data/NP_alignment.fasta')) + './NP_data/NP_tree_short.newick')) self.prefs = os.path.abspath(os.path.join(os.path.dirname(__file__), - './NP_data/NP_prefs.tsv')) - self.nsites = len(phydmslib.file_io.ReadCodonAlignment(self.alignment, - True)[0][1]) // 3 + './NP_data/NP_prefs_5.csv')) prefs = phydmslib.file_io.readPrefs(self.prefs, minpref=0.005) aas = [INDEX_TO_AA[a] for a in range(N_AA)] - self.shuffledsites = random.sample(sorted(prefs.keys()), 10) + self.shuffledsites = random.sample(sorted(prefs.keys()), 2) self.targetaas = dict([(r, random.choice(aas)) for r in self.shuffledsites]) prefs = [prefs[r] for r in sorted(list(prefs.keys()))] hipref = 0.9 @@ -62,7 +58,7 @@ def setUp(self): def test_OnSimulatedData(self): """Run ``phydms`` on the simulated data.""" random.seed(1) - scipy.random.seed(1) + scipy.random.seed(0) partitions = phydmslib.simulate.pyvolvePartitions(self.model) evolver = pyvolve.Evolver(partitions=partitions, tree=pyvolve.read_tree(file=self.tree)) diff --git a/tests/test_omegabysite.py b/tests/test_omegabysite.py index 9ed22ba1..cc0b5b60 100644 --- a/tests/test_omegabysite.py +++ b/tests/test_omegabysite.py @@ -22,12 +22,11 @@ class test_OmegaBySiteExpCM(unittest.TestCase): def setUp(self): self.tree = os.path.abspath(os.path.join(os.path.dirname(__file__), './NP_data/NP_tree_short.newick')) - self.alignment = os.path.abspath(os.path.join(os.path.dirname(__file__), - './NP_data/NP_alignment_short.fasta')) - self.prefs = os.path.abspath(os.path.join(os.path.dirname(__file__), - './NP_data/NP_prefs_short.csv')) - self.nsites = len(phydmslib.file_io.ReadCodonAlignment(self.alignment, - True)[0][1]) // 3 + self.prefsfname = os.path.abspath(os.path.join(os.path.dirname(__file__), + './NP_data/NP_prefs_shorter.csv')) + self.prefs = phydmslib.file_io.readPrefs(self.prefsfname, minpref=0.005) + self.prefs = [self.prefs[r] for r in sorted(list(self.prefs.keys()))] + self.nsites = len(self.prefs) self.initializeModel() self.outdir = os.path.abspath(os.path.join(os.path.dirname(__file__), './omegabysite_test_results/')) @@ -35,13 +34,11 @@ def setUp(self): os.mkdir(self.outdir) def initializeModel(self): - prefs = phydmslib.file_io.readPrefs(self.prefs, minpref=0.005) - prefs = [prefs[r] for r in sorted(list(prefs.keys()))] # Using beta < 1 partially flattens prefs in simulation # Use mu < 1 to get branch lengths about right - self.model = phydmslib.models.ExpCM(prefs, beta=0.5, mu=0.5) + self.model = phydmslib.models.ExpCM(self.prefs, beta=0.5, mu=0.5) self.modelname = 'ExpCM' - self.modelarg = 'ExpCM_{0}'.format(self.prefs) + self.modelarg = 'ExpCM_{0}'.format(self.prefsfname) def test_OnSimulatedData(self): random.seed(1) diff --git a/tests/test_phydms_comprehensive.py b/tests/test_phydms_comprehensive.py index cc23838a..e9bf9cd4 100644 --- a/tests/test_phydms_comprehensive.py +++ b/tests/test_phydms_comprehensive.py @@ -1,81 +1,124 @@ -"""Runs ``phydms_comprehensive`` - -This test examines the entire functionality of ``phydms_comprehensive`` -when run from the command line. - -Written by Jesse Bloom and Sarah Hilton. -""" - -import os -import unittest -import multiprocessing -import subprocess -import numpy -import scipy -import pandas - - -class test_phydms_comprehensive(unittest.TestCase): - """Tests command-line ``phydms_comprehensive``.""" - - def test_NP(self): - """Tests command-line ``phydms_comprehensive`` on NP data.""" - tree = os.path.abspath(os.path.join(os.path.dirname(__file__), - './NP_data/NP_tree_short.newick')) - alignment = os.path.abspath(os.path.join(os.path.dirname(__file__), - './NP_data/NP_alignment_short.fasta')) - prefs = os.path.abspath(os.path.join(os.path.dirname(__file__), - './NP_data/NP_prefs_short.csv')) - for f in [prefs, alignment]: - self.assertTrue(os.path.isfile(f), "Can't find file {0}".format(f)) - outprefix = os.path.abspath(os.path.join(os.path.dirname(__file__), - './NP_test_results/')) - if outprefix[-1] != "/": - outprefix = "{0}/".format(outprefix) - - ncpus = min(20, multiprocessing.cpu_count()) - - subprocess.check_call(['phydms_comprehensive', outprefix, alignment, - prefs, "--tree", tree, "--omegabysite", '--brlen', 'scale', - '--ncpus', str(ncpus)]) - - expectedresults = os.path.abspath(os.path.join(os.path.dirname(__file__), - './expected_NP_test_results/')) - - models = ['ExpCM_NP_prefs_short', 'averaged_ExpCM_NP_prefs_short', 'YNGKP_M0', - 'YNGKP_M5'] - - for model in models: - values = {} - for (name, prefix) in [('expected', expectedresults), ('actual', outprefix)]: - values[name] = {} - for suffix in ['_loglikelihood.txt', '_modelparams.txt']: - fname = os.path.abspath(os.path.join(prefix, - './{0}{1}'.format(model, suffix))) - with open(fname) as f: - for line in f: - (x, y) = line.split('=') - values[name][x.strip()] = float(y) - for param in values['actual'].keys(): - self.assertTrue(numpy.allclose(values['actual'][param], - values['expected'][param], atol=1e-2, rtol=1e-5)) - - omegas = {} - for (name, prefix) in [('expected', expectedresults), ('actual', outprefix)]: - fname = os.path.abspath(os.path.join(prefix, - './{0}{1}'.format(model, '_omegabysite.txt'))) - omegas[name] = pandas.read_csv(fname, - comment='#', sep='\t') - omegas[name] = omegas[name].sort_values(by='site', axis=0) - self.assertTrue(numpy.allclose(omegas['actual']['P'].values, - omegas['expected']['P'].values, atol=0.01, rtol=0.03)) - sigsites = omegas['expected'][omegas['expected']['P'] < 0.05]['site'].values - sigomegas = {} - for (name, df) in omegas.items(): - sigomegas[name] = omegas[name][omegas[name]['site'].isin(sigsites)]['omega'].values - self.assertTrue(((sigomegas['actual'] > 1) == (sigomegas['expected'] > 1)).all()) - - -if __name__ == '__main__': - runner = unittest.TextTestRunner() - unittest.main(testRunner=runner) +"""Runs ``phydms_comprehensive`` + +This test examines the functionality of ``phydms_comprehensive`` when run +from the command-line with the `--gammaomega` and +`--omega_random_effects_likelihood` flags. + +Written by Jesse Bloom, Sarah Hilton, and Jonathan Mah +""" + +import os +import unittest +import multiprocessing +import subprocess +import scipy +import pandas + + +class test_phydms_comprehensive(unittest.TestCase): + """Tests command-line ``phydms_comprehensive`` with the `--gammaomega` + and `--omega_random_effects_likelihood` flags. This test is performed with + the minimum number of categories used for integration, being 2.""" + + def test_NP(self): + """Tests command-line ``phydms_comprehensive`` on NP data.""" + tree = os.path.abspath(os.path.join( + os.path.dirname(__file__), './NP_data/NP_tree_short.newick')) + alignment = os.path.abspath(os.path.join( + os.path.dirname(__file__), './NP_data/NP_alignment_short.fasta')) + prefs = os.path.abspath(os.path.join( + os.path.dirname(__file__), './NP_data/NP_prefs_short.csv')) + for f in [prefs, alignment]: + self.assertTrue(os.path.isfile(f), "Can't find file {0}".format(f)) + outprefix = os.path.abspath(os.path.join( + os.path.dirname(__file__), './NP_test_results/')) + if outprefix[-1] != "/": + outprefix = "{0}/".format(outprefix) + + ncpus = min(20, multiprocessing.cpu_count()) + + K = 2 # Number of bins used in fitting gamma distribution + + J = 2 # Number of bins used in empirical Bayesian integration + + subprocess.check_call( + ['phydms_comprehensive', outprefix, alignment, + prefs, "--tree", tree, "--omegabysite", '--brlen', 'scale', + '--ncpus', str(ncpus), '--gammaomega', '--ncats', str(K), + '--omega_random_effects_likelihood', '--REL_ncats', str(J)]) + + expectedresults = os.path.abspath(os.path.join( + os.path.dirname(__file__), './expected_NP_test_results/')) + + models = ['ExpCM_NP_prefs_short', 'YNGKP_M0', 'YNGKP_M5', + 'ExpCM_NP_prefs_short_gammaomega'] + + for model in models: + values = {} + for (name, prefix) in [('expected', expectedresults), + ('actual', outprefix)]: + values[name] = {} + for suffix in ['_loglikelihood.txt', '_modelparams.txt']: + fname = os.path.abspath(os.path.join( + prefix, './{0}{1}'.format(model, suffix))) + with open(fname) as f: + for line in f: + (x, y) = line.split('=') + values[name][x.strip()] = float(y) + for param in values['actual'].keys(): + self.assertTrue(scipy.allclose( + values['actual'][param], + values['expected'][param], atol=1e-2, rtol=1e-5)) + # FEL + omegas = {} + for (name, prefix) in [('expected', expectedresults), + ('actual', outprefix)]: + fname = os.path.abspath(os.path.join( + prefix, './{0}{1}'.format(model, '_omegabysite.txt'))) + omegas[name] = pandas.read_csv( + fname, comment='#', sep='\t') + omegas[name] = omegas[name].sort_values(by='site', axis=0) + self.assertTrue(scipy.allclose( + omegas['actual']['P'].values, + omegas['expected']['P'].values, atol=0.01, rtol=0.03)) + sigsites = omegas['expected'][ + omegas['expected']['P'] < 0.05]['site'].values + sigomegas = {} + for (name, df) in omegas.items(): + sigomegas[name] = omegas[name][ + omegas[name]['site'].isin(sigsites)]['omega'].values + self.assertTrue((( + sigomegas['actual'] > 1) == (sigomegas['expected'] > 1)).all()) + + # REL + if 'gammomega' in model or model == 'YNGKP_M5': + omegas = {} + for (name, prefix) in [('expected', expectedresults), + ('actual', outprefix)]: + fname = os.path.abspath(os.path.join( + prefix, './{0}{1}'.format(model, '_omegabycategory.csv'))) + omegas[name] = pandas.read_csv(fname) + self.assertTrue(scipy.allclose( + omegas['actual']['post_probability'].values, + omegas['expected']['post_probability'].values, + atol=0.001, rtol=0.003)) + self.assertTrue(scipy.allclose( + omegas['actual']['omega'].values, + omegas['expected']['omega'].values, + atol=0.001, rtol=0.003)) + + posteriors = {} + for (name, prefix) in [('expected', expectedresults), + ('actual', outprefix)]: + fname = os.path.abspath(os.path.join( + prefix, './{0}{1}'.format(model, '_posteriorprobabilities.csv'))) + posteriors[name] = pandas.read_csv(fname) + self.assertTrue(scipy.allclose( + posteriors['actual']['p(omega > 1)'].values, + posteriors['expected']['p(omega > 1)'].values, + atol=0.001, rtol=0.003)) + + +if __name__ == '__main__': + runner = unittest.TextTestRunner() + unittest.main(testRunner=runner) diff --git a/tests/test_phydms_rel.py b/tests/test_phydms_rel.py new file mode 100644 index 00000000..6384be05 --- /dev/null +++ b/tests/test_phydms_rel.py @@ -0,0 +1,149 @@ +"""Runs the REL implementation of ``phydms``. + +This test examines the functionality of the REL implementation of ``phydms``. + +Written by Jonathan Mah +""" + +import os +import unittest +import multiprocessing +import subprocess +import pandas +import scipy + + +class test_phydms_rel_ExpCM_k2_4(unittest.TestCase): + """Tests command-line usage of REL implementation of ``phydms`` with 4 bins + used for integration. + """ + TREE = os.path.abspath(os.path.join(os.path.dirname(__file__), + './REL_input_data/NP_tree.newick')) + ALIGNMENT = os.path.abspath(os.path.join(os.path.dirname(__file__), + './REL_input_data/NP_alignment.fasta')) + PREFS = os.path.abspath(os.path.join(os.path.dirname(__file__), + './REL_input_data/NP_prefs.csv')) + MODEL = 'ExpCM' + J = 4 # Number of bins used for empirical Bayesian integration + OUTPREFIX = os.path.abspath(os.path.join(os.path.dirname(__file__), + './_phydms_rel_test_results/')) + EXPECTED_PREFIX = os.path.abspath(os.path.join(os.path.dirname(__file__), + './expected_rel_test_results/real_data')) + + if OUTPREFIX[-1] != '/': + OUTPREFIX = '{0}/'.format(OUTPREFIX) + if EXPECTED_PREFIX[-1] != '/': + EXPECTED_PREFIX = '{0}/'.format(EXPECTED_PREFIX) + + def test_rel_expected_output(self): + """Tests expected output from command-line usage of REL implementation + of ``phydms``. + """ + # Confirm input data exist + for f in [self.ALIGNMENT, self.TREE, self.PREFS]: + self.assertTrue( + os.path.isfile(f), "Can't find test file {0}".format(f)) + + ncpus = 1 + model_with_bins = self.MODEL + '_k2_' + str(self.J) + + if self.MODEL is 'ExpCM': + subprocess.check_call(['phydms', self.ALIGNMENT, self.TREE, + 'ExpCM_{0}'.format(self.PREFS), + self.OUTPREFIX + model_with_bins, + '--ncpus', str(ncpus), '--gammaomega', + '--omega_random_effects_likelihood', + '--REL_ncats', str(self.J)]) + elif self.MODEL is 'YNGKP_M5': + subprocess.check_call(['phydms', self.ALIGNMENT, self.TREE, + 'YNGKP_M5', self.OUTPREFIX + model_with_bins, + '--ncpus', str(ncpus), + '--omega_random_effects_likelihood', + '--REL_ncats', str(self.J)]) + else: + raise ValueError('Only ExpCM and YNGKP models are implemented at ' + 'this time.') + + self.compare_output_dataframes( + self.OUTPREFIX, self.EXPECTED_PREFIX, model_with_bins) + + self.remove_output_files(self.OUTPREFIX, model_with_bins) + if not os.listdir(self.OUTPREFIX): + os.rmdir(self.OUTPREFIX) + + def compare_output_dataframes(self, outprefix, expected_prefix, + model_with_bins): + omegas = {} + for (name, prefix) in [('expected', expected_prefix), + ('actual', outprefix)]: + fname = os.path.abspath(os.path.join(prefix, './{0}{1}'.format( + model_with_bins, '_omegabycategory.csv'))) + omegas[name] = pandas.read_csv(fname) + self.assertTrue(scipy.allclose( + omegas['actual']['post_probability'].values, + omegas['expected']['post_probability'].values, + atol=0.001, rtol=0.003)) + self.assertTrue(scipy.allclose( + omegas['actual']['omega'].values, + omegas['expected']['omega'].values, + atol=0.001, rtol=0.003)) + + posteriors = {} + for (name, prefix) in [('expected', expected_prefix), + ('actual', outprefix)]: + fname = os.path.abspath(os.path.join(prefix, './{0}{1}'.format( + model_with_bins, '_posteriorprobabilities.csv'))) + posteriors[name] = pandas.read_csv(fname) + self.assertTrue(scipy.allclose( + posteriors['actual']['p(omega > 1)'].values, + posteriors['expected']['p(omega > 1)'].values, + atol=0.001, rtol=0.003)) + + def remove_output_files(self, outprefix, model_with_bins): + suffix_list = ['_omegabycategory.csv', '_posteriorprobabilities.csv', + '_log.log', '_loglikelihood.txt', '_tree.newick', + '_modelparams.txt'] + for suffix in suffix_list: + fname = os.path.abspath(os.path.join(outprefix, './{0}{1}'.format( + model_with_bins, suffix))) + if os.path.isfile(fname): + os.remove(fname) + + +class test_phydms_rel_ExpCM_k2_50(test_phydms_rel_ExpCM_k2_4): + """Tests command-line usage of REL implementation of ``phydms`` with 50 + bins used for integration. + """ + J = 50 + + +class test_phydms_rel_YNGKP_M5_k2_4(test_phydms_rel_ExpCM_k2_4): + """Tests command-line usage of REL implementation of YNGKP_M5 with 4 + bins used for integration. + """ + MODEL = 'YNGKP_M5' + + +class test_phydms_rel_YNGKP_M5_k2_50(test_phydms_rel_YNGKP_M5_k2_4): + """Tests command-line usage of REL implementation of YNGKP_M5 with 50 + bins used for integration. + """ + J = 50 + + +class test_phydms_rel_ExpCM_simulated(test_phydms_rel_ExpCM_k2_4): + """Tests command-line usage of REL implementation of ``phydms`` with + 4 bins used for integration, applied to a simulated sequence with + one site under strong positive selection. + """ + ALIGNMENT = os.path.abspath( + os.path.join(os.path.dirname(__file__), + './REL_input_data/NP_simulated_alignment.fasta')) + EXPECTED_PREFIX = os.path.abspath( + os.path.join(os.path.dirname(__file__), + './expected_rel_test_results/simulated_data')) + + +if __name__ == '__main__': + runner = unittest.TextTestRunner() + unittest.main(testRunner=runner) diff --git a/tests/test_simulator.py b/tests/test_simulator.py new file mode 100644 index 00000000..93948b5b --- /dev/null +++ b/tests/test_simulator.py @@ -0,0 +1,136 @@ +"""Tests `Simulator` class to ensure reproducible results. + +Compares an alignment created by `Simulator` to expected results. + +Written by Sarah Hilton and Jesse Bloom. +""" + +import os +import sys +import scipy +import math +import unittest +import random +import io +import copy +import phydmslib.models +import phydmslib.treelikelihood +import phydmslib.simulate +from phydmslib.constants import * +from phydmslib.file_io import ReadCodonAlignment +import Bio.SeqIO +import Bio.Phylo +import pyvolve + + +class test_Simulator_ExpCM(unittest.TestCase): + """Tests the `Simulator` class`""" + + # use approach here to run multiple tests: + # http://stackoverflow.com/questions/17260469/instantiate-python-unittest-testcase-with-arguments + MODEL = phydmslib.models.ExpCM_empirical_phi + EXPECTED = os.path.join(os.path.abspath(os.path.dirname(__file__)), + 'expected_simulator_results/expected_simulator_ExpCM.fasta') + + def setUp(self): + """Set up parameters for test.""" + # define model + scipy.random.seed(0) + self.nsites = 1000 + prefs = [] + minpref = 0.01 + for r in range(self.nsites): + rprefs = scipy.random.dirichlet([1] * N_AA) + rprefs[rprefs < minpref] = minpref + rprefs /= rprefs.sum() + prefs.append(dict(zip(sorted(AA_TO_INDEX.keys()), rprefs))) + kappa = 4.2 + omega = 0.4 + beta = 1.5 + mu = 0.3 + if self.MODEL == phydmslib.models.ExpCM: + phi = scipy.random.dirichlet([7] * N_NT) + self.model = phydmslib.models.ExpCM(prefs, kappa=kappa, omega=omega, + beta=beta, mu=mu, phi=phi, + freeparams=['mu']) + elif self.MODEL == phydmslib.models.ExpCM_empirical_phi: + g = scipy.random.dirichlet([7] * N_NT) + self.model = phydmslib.models.ExpCM_empirical_phi(prefs, g, + kappa=kappa, + omega=omega, + beta=beta, + mu=mu, + freeparams=['mu']) + elif self.MODEL == phydmslib.models.YNGKP_M0: + e_pw = scipy.asarray([scipy.random.dirichlet([7] * N_NT) for i + in range(3)]) + self.model = phydmslib.models.YNGKP_M0(e_pw, self.nsites) + elif self.MODEL == phydmslib.models.ExpCM_empirical_phi_divpressure: + divpressure = scipy.ndarray(1000, dtype=float) + for x in range(0, 500): + divpressure[x] = 1 + scipy.random.shuffle(divpressure) + g = scipy.random.dirichlet([7] * N_NT) + self.model = phydmslib.models.ExpCM_empirical_phi_divpressure( + prefs, g, kappa=kappa, omega=omega, omega2=self.OMEGA_2, + beta=beta, mu=mu, divPressureValues=divpressure, freeparams=['mu']) + else: + raise ValueError("Invalid MODEL: {0}".format(type(self.MODEL))) + + # make a test tree + # tree is two sequences separated by a single branch + # the units are in sub/site + self.t = 0.04 + newicktree = '(tip1:{0},tip2:{0});'.format(self.t / 2.0) + self.tree_fname = '_temp.tree' + with open(self.tree_fname, 'w') as f: + f.write(newicktree) + self.tree = Bio.Phylo.read(self.tree_fname, 'newick') + + def test_simulateAlignment_Simulator(self): + """Compare simulation to known sequence.""" + # simulate an alignment with seeds 1 and 2 + simulator = phydmslib.simulate.Simulator(self.tree, self.model) + seed1 = dict(simulator.simulate(1)) + seed2 = dict(simulator.simulate(2)) + + # read in expected results + expected = dict(ReadCodonAlignment(self.EXPECTED, + checknewickvalid=True)) + + # checks + self.assertTrue(len(seed1) == len(seed2) == len(expected), + "Alignments different lengths") + for seq_id in seed1.keys(): + if self.MODEL == phydmslib.models.ExpCM_empirical_phi_divpressure: + self.assertTrue( + seed1[seq_id] != expected[seq_id] and + seed2[seq_id] != expected[seq_id], + ("Sequences generated with divpressure should be" + "different from alignments without divpressure.")) + else: + self.assertTrue(seed1[seq_id] == expected[seq_id], + ("Sequence {0} different between simulated " + "and expected alignment".format(seq_id))) + self.assertFalse(seed2[seq_id] == expected[seq_id], + ("Sequence {0} from seed 2 should be " + "different from expected " + "alignment".format(seq_id))) + + +class test_Simulator_YNGKP_MO(test_Simulator_ExpCM): + """Tests `Simulator` simulation of `YNGKP_M0` model.""" + MODEL = phydmslib.models.YNGKP_M0 + EXPECTED = os.path.join(os.path.abspath(os.path.dirname(__file__)), + 'expected_simulator_results/expected_simulator_YNGKP_MO.fasta') + +class test_Simulator_ExpCM_divpressure(test_Simulator_ExpCM): + """Tests `Simulator` simulation of `ExpCM` model with divpressure flag.""" + + MODEL = phydmslib.models.ExpCM_empirical_phi_divpressure + OMEGA_2 = 0.25 + + +if __name__ == '__main__': + runner = unittest.TextTestRunner() + unittest.main(testRunner=runner) diff --git a/tests/test_treelikelihood.py b/tests/test_treelikelihood.py index 04e8e739..d31bff33 100644 --- a/tests/test_treelikelihood.py +++ b/tests/test_treelikelihood.py @@ -50,7 +50,7 @@ def setUp(self): # simulate alignment with pyvolve pyvolvetree = pyvolve.read_tree(tree=self.newick) - self.nsites = 60 + self.nsites = 20 self.nseqs = self.tree.count_terminals() e_pw = scipy.ndarray((3, N_NT), dtype='float') e_pw.fill(0.25) @@ -166,7 +166,7 @@ def test_Likelihood(self): """Tests likelihood.""" random.seed(1) scipy.random.seed(1) - + if self.DISTRIBUTIONMODEL: return # test doesn't work for DistributionModel mus = [0.5, 1.5] @@ -213,7 +213,7 @@ def test_LikelihoodDerivativesModelParams(self): """Test derivatives of with respect to model params.""" random.seed(1) scipy.random.seed(1) - + tl = phydmslib.treelikelihood.TreeLikelihood(self.tree, self.alignment, self.model) @@ -245,7 +245,7 @@ def test_MaximizeLikelihood(self): Make sure it gives the same value for several starting points.""" random.seed(1) scipy.random.seed(1) - + tl = phydmslib.treelikelihood.TreeLikelihood(self.tree, self.alignment, self.model) diff --git a/tests/time_test_results.csv b/tests/time_test_results.csv deleted file mode 100644 index 021a5492..00000000 --- a/tests/time_test_results.csv +++ /dev/null @@ -1,24 +0,0 @@ -test,time,Greater_10min -test_YNGKPM0,0.1223950982093811,n -test_brlenderivatives,12.472390015920004,y -test_brlenoptimize,1.902949837843577,n -test_doctests,0.00020822286605834961,n -test_expcm,1.2703020493189494,n -test_expcm_divpressure,4.652334590752919,n -test_expcm_empirical_phi,3.678126660982768,n -test_expcm_fitprefs,3.797766160964966,n -test_expcm_fitprefs_invquadraticprior,0.010703472296396892,n -test_phydms_divpressure,0.8540565252304078,n -test_phydms_logoplot,0.41759550174077353,n -test_prepalignment,0.5036757667859395,n -test_readDivPressure,0.002141086260477702,n -test_readprefs,0.0739794651667277,n -test_treelikelihood,7.972783621152242,n -test_alignmentSimulation,7.9941790223121645,n -test_spielmanwr,0.003055755297342936,n -test_treelikelihood_fitprefs,1.2431865056355795,n -test_gammadistributedomega_model,0.11611405611038209,n -test_underflow,2.329277690251668,n -test_alignmentSimulationRandomSeed,5.38967567284902,n -test_alignmentSimulation_divpressure,3.7652630607287088,n -test_gammadistributedbeta_model,0.23758074442545574,n