Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Random-Effects-Likelihood Method #30

Draft
wants to merge 316 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
316 commits
Select commit Hold shift + click to select a range
85d817a
added multiprocessing to phydms_modeladequacy
skhilton Nov 27, 2018
74d9063
cleaned up the test directory
skhilton Nov 28, 2018
15e22b3
multiprocessing is used only if ncpu greater than one
skhilton Nov 28, 2018
6bef390
added test for model adequacy with and without multiprocessing
skhilton Nov 28, 2018
c8ff083
small formatting tweaks
skhilton Nov 28, 2018
30ee720
refactored code to perform simulations in batches
skhilton Nov 30, 2018
da02af9
make sure there are >= 100 simulations per CPU
skhilton Nov 30, 2018
fc67e3f
increased number of simulations in multiprocessing test
skhilton Nov 30, 2018
c1da353
removed slow list comprehension in kldiv function
skhilton Nov 30, 2018
c2586d4
cleaned up code around multiprocessor/no multiprocessor switch
skhilton Nov 30, 2018
f329a16
fixed sites being indexed at 0 to indexed at 1 for outputs
skhilton Nov 30, 2018
066b714
streamlined processing of the simulations
skhilton Nov 30, 2018
8b5bf32
changed min number of simuluations per CPU to 1000
skhilton Nov 30, 2018
37e8caf
Merge branch 'master' into model_adequacy
jbloom Dec 12, 2018
67f0758
Update .travis.yml
skhilton Dec 13, 2018
4993109
ignore failing tests
skhilton Dec 13, 2018
7ee2e5c
specified float formatting in doctest
skhilton Dec 13, 2018
03d6fe6
Merge branch 'model_adequacy' of https://github.com/jbloomlab/phydms …
skhilton Dec 13, 2018
07baa70
made test file paths more robust
skhilton Dec 14, 2018
bed0509
removed call to raxml and made file paths more robust
skhilton Dec 14, 2018
26dfc85
fixed bug in CPU distribution
skhilton Dec 14, 2018
4e66ec2
Updated travis.yml
jon-mah Dec 14, 2018
fc9b24a
Ignore failing modeladequacy tests
jon-mah Dec 15, 2018
0df81b2
cleaned up distance calculations
skhilton Dec 17, 2018
32ad1c7
sequestered failing test
skhilton Dec 17, 2018
6d69418
fixed doctest for prefdistance
skhilton Dec 17, 2018
d16b18c
added a dictionary
skhilton Dec 17, 2018
1a61199
clean up multiprocessing in model adequacy
skhilton Dec 17, 2018
7328f9d
clean up random seed setting in simulator.simulate
skhilton Dec 17, 2018
466efb4
added layered cacheing to simulator.simulate
skhilton Dec 17, 2018
2d079d5
added test to make sure 1 CPU and > 1 CPU get the same answer
skhilton Dec 17, 2018
9af4de2
Absolute pathing, working build
jon-mah Dec 17, 2018
61f8ceb
fixed translate with gaps function in compare simulators tests
skhilton Dec 17, 2018
6e2544b
Shortened input data, updated expected results, working build.
jon-mah Dec 17, 2018
389f06f
set check_input default value to True
skhilton Dec 17, 2018
3d3ccf8
Absolute pathing for expected outputs.
jon-mah Dec 17, 2018
097ed1d
Absolute pathing for all files.
jon-mah Dec 17, 2018
4694f7b
Refactored tests to resemble test_phydms_comprehensive
jon-mah Dec 17, 2018
9a84e99
small tweak to multiprocessing
skhilton Dec 17, 2018
f058832
Added tests for simulated data, associated expected results, working …
jon-mah Dec 18, 2018
142c0b9
added the correct file for the phydms_modeladequacy test
skhilton Jan 10, 2019
52c9814
small tweak to test description
skhilton Jan 10, 2019
2a3e99f
fixed phydms modeladequacy multiprocessing test script
skhilton Jan 10, 2019
19b1ae1
fixed multiprocessing in phydms_modeladequacy
skhilton Jan 10, 2019
f720646
small tweaks to test formatting
skhilton Jan 10, 2019
26df9d4
formatting tweaks to model adequacy script
skhilton Jan 10, 2019
709943c
tweaks to script
skhilton Jan 11, 2019
6e56ab7
added phydms_modeladequacy tests to Travis CI
skhilton Jan 11, 2019
39ff94a
increased the number of simulations/CPU to 1000
skhilton Jan 11, 2019
fa1269b
print out expected and actual results for failing tests
skhilton Jan 11, 2019
0e75b5f
fixed typo
skhilton Jan 11, 2019
ee90a52
fixed formatting on error message
skhilton Jan 11, 2019
614df9b
fixed test typo
skhilton Jan 11, 2019
8a5378b
added tolerance to tests
skhilton Jan 11, 2019
ea83bab
fixed typo in error message
skhilton Jan 11, 2019
300c691
increased the tolerance
skhilton Jan 12, 2019
52e6925
removed tolerance in model adequacy test
skhilton Jan 15, 2019
5d8114d
fixed typo in test
skhilton Jan 15, 2019
ec41176
ignore multiprocessing test
skhilton Jan 25, 2019
227b173
switched to NP data
skhilton Jan 25, 2019
ba87db7
reduced number of simulations
skhilton Jan 25, 2019
0779e2b
changed multiprocessing test to NP data
skhilton Jan 25, 2019
5cb276d
removed obsolete input data directory
skhilton Jan 25, 2019
f46c353
removed old files
skhilton Jan 25, 2019
73305cf
utilize full paths for RAxML
skhilton Jan 31, 2019
cf22928
added RMSD metric to phydms_modeladequacy
skhilton Feb 1, 2019
a191657
updated tests to include RMSD results
skhilton Feb 1, 2019
ab38af8
added max number of simulations per CPU
skhilton Feb 13, 2019
cd36531
Merge branch 'model_adequacy' of https://github.com/jbloomlab/phydms …
skhilton Feb 13, 2019
f4da63a
fixed inability to handle a large number of simulations
skhilton Feb 14, 2019
ef2a035
Added gammaomega and empirical Bayes capabilities to phydms_comprehen…
jon-mah Feb 14, 2019
0a92517
Split phydms_comprehensive tests into two, added --ncats flag functio…
jon-mah Feb 15, 2019
1038bd5
shortened diff prefs test
skhilton Feb 16, 2019
43a59b7
Merge model_adequacy to REL, resolve conflict in pytest.ini
jon-mah Feb 21, 2019
b5eee44
Added test cases for divpressure. Tests expected to fail.
jon-mah Mar 7, 2019
0e1b1eb
added rateMatrixPrefix option to phydmslib.simulate
skhilton Oct 15, 2018
706871f
started the phydmslib.modeladequacy modules
skhilton Oct 16, 2018
ce4a3df
fixed typo in calc_aa_frequencies doctest
skhilton Oct 17, 2018
99422c2
small tweaks to calc_aa_frequencies
skhilton Oct 17, 2018
6a61fde
added sequence length check to translate_with_gaps
skhilton Oct 17, 2018
08e8c96
added more functions to modeladequacy and started test script
skhilton Oct 19, 2018
efba620
small tweaks to test script
skhilton Oct 19, 2018
05ee0a6
renamed variable to follow lowercase conventions
skhilton Oct 19, 2018
fd124c9
seed numpy random seed in simulate
skhilton Oct 19, 2018
f6ef303
added ability to do replicate simulations
skhilton Oct 26, 2018
4bf369d
first pass at model_adequacy script
skhilton Nov 2, 2018
03515a6
small tweak to parse arguments
skhilton Nov 2, 2018
112a5ef
added profiling script for modeladequacy
skhilton Nov 2, 2018
75c8f1e
added pstats output
skhilton Nov 2, 2018
77a6f59
added script to profile model adequacy
skhilton Nov 6, 2018
87f0a29
added additional checks to the replicate alignment test
skhilton Nov 6, 2018
5e82363
removed extraneous file
skhilton Nov 6, 2018
a5c5199
fixed bug in profiling script
skhilton Nov 6, 2018
ead9612
small tweak to profile script
skhilton Nov 6, 2018
c7d9a7b
started test for model adequacy test
skhilton Nov 6, 2018
68338b9
added new class simulator to simulate.py
skhilton Nov 7, 2018
9e76ea7
added new simulation method to the simulation test
skhilton Nov 7, 2018
7686fad
tweaks to simulate.py
skhilton Nov 8, 2018
8290fa3
refactored alignment simulation test
skhilton Nov 8, 2018
e9fff26
changes to simulate.py
skhilton Nov 8, 2018
587370b
changed node attributes in simulator to private
skhilton Nov 9, 2018
219dc21
small tweaks to simulatoin test
skhilton Nov 9, 2018
963e8fb
added Simulator class to random seed test
skhilton Nov 9, 2018
5cb7cb5
added profile code and profiling results
skhilton Nov 9, 2018
cdd3697
some changes that speed up `Simulate.simulate`
jbloom Nov 9, 2018
05daf6c
added test to check simulator against expected results
skhilton Nov 9, 2018
a153d58
small tweaks to simulate.py
skhilton Nov 9, 2018
1c2123b
added comparison test
skhilton Nov 10, 2018
32f56da
small tweak to docstring
skhilton Nov 10, 2018
9574d03
removed old profiling output
skhilton Nov 13, 2018
56acf0d
removed unused function from phydmslib/modeladequacy
skhilton Nov 13, 2018
a6ace82
model adequacy script runs through all the way
skhilton Nov 13, 2018
5dd945a
cache the cumulative sums and sequence arrays
skhilton Nov 13, 2018
bb42834
added function to output an alignment
skhilton Nov 13, 2018
ab5e8c2
added another test for random seed setting
skhilton Nov 13, 2018
16526ab
added pvalue calculation function to modeladequacy
skhilton Nov 14, 2018
7ac2968
added in random seed and simplified simulation processing
skhilton Nov 14, 2018
7d06d25
removed unnecessary test files
skhilton Nov 14, 2018
0f96097
added YNGKP_M0 to phydms_modeladequacy and fixed random seed
skhilton Nov 14, 2018
4546e06
added test of phydms_modeladequacy against expected results
skhilton Nov 14, 2018
0cc8553
small formatting tweaks
skhilton Nov 14, 2018
2414996
fixed how the random seed is set in simulator and updated expected re…
skhilton Nov 19, 2018
2672a2c
small tweaks to simulate.py
skhilton Nov 19, 2018
4a0a662
removed metrics flag
skhilton Nov 19, 2018
1c1f27d
changed default number of simulations and clarified models accepted
skhilton Nov 19, 2018
29801be
seed each call of simulator
skhilton Nov 19, 2018
7d3de28
added more interpretable error message
skhilton Nov 19, 2018
7804559
removed unncessary function
skhilton Nov 19, 2018
a9d25ae
update phydms_modeladequacy test with nSim as optional param
skhilton Nov 20, 2018
da8c378
fixed random seed setting in test_alignmentSimulation.py
skhilton Nov 20, 2018
7dd0fa4
refactored simulate code to only store codon index
skhilton Nov 20, 2018
a96f1fd
cleaned up comments
skhilton Nov 20, 2018
db01f80
small tweaks to simulate.py
skhilton Nov 20, 2018
e05567b
cleaned up variable names
skhilton Nov 20, 2018
5a09ff8
replaced for loop with starmap
skhilton Nov 21, 2018
41ddd49
set numpy random seed as well as scipy random seed
skhilton Nov 27, 2018
394520c
implemented with itertools starmap
skhilton Nov 27, 2018
b0db690
set random seed during pvalue calculation
skhilton Nov 27, 2018
2d7795d
fixed seed setting in pvalue calculation function
skhilton Nov 27, 2018
66c18bb
added multiprocessing to phydms_modeladequacy
skhilton Nov 27, 2018
2d0d5cb
cleaned up the test directory
skhilton Nov 28, 2018
af65bca
multiprocessing is used only if ncpu greater than one
skhilton Nov 28, 2018
e190e0d
added test for model adequacy with and without multiprocessing
skhilton Nov 28, 2018
2c92763
small formatting tweaks
skhilton Nov 28, 2018
874f564
refactored code to perform simulations in batches
skhilton Nov 30, 2018
a4f596b
make sure there are >= 100 simulations per CPU
skhilton Nov 30, 2018
3d25eed
increased number of simulations in multiprocessing test
skhilton Nov 30, 2018
b24fcaa
removed slow list comprehension in kldiv function
skhilton Nov 30, 2018
251d4ff
cleaned up code around multiprocessor/no multiprocessor switch
skhilton Nov 30, 2018
2eeffc9
fixed sites being indexed at 0 to indexed at 1 for outputs
skhilton Nov 30, 2018
d8529e7
streamlined processing of the simulations
skhilton Nov 30, 2018
2c8f805
changed min number of simuluations per CPU to 1000
skhilton Nov 30, 2018
f3b7b95
ignore failing tests
skhilton Dec 13, 2018
f8ddc8a
specified float formatting in doctest
skhilton Dec 13, 2018
679330e
made test file paths more robust
skhilton Dec 14, 2018
b9c8bb5
removed call to raxml and made file paths more robust
skhilton Dec 14, 2018
e123249
fixed bug in CPU distribution
skhilton Dec 14, 2018
39c8864
Updated travis.yml
jon-mah Dec 14, 2018
3fd8cc9
Ignore failing modeladequacy tests
jon-mah Dec 15, 2018
d342bbb
cleaned up distance calculations
skhilton Dec 17, 2018
fa766a2
fixed doctest for prefdistance
skhilton Dec 17, 2018
5b7e722
added a dictionary
skhilton Dec 17, 2018
7cd0a64
clean up multiprocessing in model adequacy
skhilton Dec 17, 2018
f3b4ce3
clean up random seed setting in simulator.simulate
skhilton Dec 17, 2018
3f40948
added layered cacheing to simulator.simulate
skhilton Dec 17, 2018
7243387
added test to make sure 1 CPU and > 1 CPU get the same answer
skhilton Dec 17, 2018
7d1f1c0
Absolute pathing, working build
jon-mah Dec 17, 2018
1729e25
fixed translate with gaps function in compare simulators tests
skhilton Dec 17, 2018
ac1e8c0
Shortened input data, updated expected results, working build.
jon-mah Dec 17, 2018
3778653
set check_input default value to True
skhilton Dec 17, 2018
fd02bdc
Absolute pathing for expected outputs.
jon-mah Dec 17, 2018
cb9782f
Absolute pathing for all files.
jon-mah Dec 17, 2018
417c21e
Refactored tests to resemble test_phydms_comprehensive
jon-mah Dec 17, 2018
84f7a31
small tweak to multiprocessing
skhilton Dec 17, 2018
6745829
Added tests for simulated data, associated expected results, working …
jon-mah Dec 18, 2018
02bd085
added the correct file for the phydms_modeladequacy test
skhilton Jan 10, 2019
0e6a7bc
small tweak to test description
skhilton Jan 10, 2019
e37e67b
fixed phydms modeladequacy multiprocessing test script
skhilton Jan 10, 2019
04a12d9
fixed multiprocessing in phydms_modeladequacy
skhilton Jan 10, 2019
7c37dd8
small tweaks to test formatting
skhilton Jan 10, 2019
2b8df92
formatting tweaks to model adequacy script
skhilton Jan 10, 2019
fb18008
tweaks to script
skhilton Jan 11, 2019
ce39b63
added phydms_modeladequacy tests to Travis CI
skhilton Jan 11, 2019
0c4ff99
increased the number of simulations/CPU to 1000
skhilton Jan 11, 2019
9a6a9e0
print out expected and actual results for failing tests
skhilton Jan 11, 2019
2a6745b
fixed typo
skhilton Jan 11, 2019
bf08921
fixed formatting on error message
skhilton Jan 11, 2019
77f471e
fixed test typo
skhilton Jan 11, 2019
36564ed
added tolerance to tests
skhilton Jan 11, 2019
39ace9f
fixed typo in error message
skhilton Jan 11, 2019
927c07f
increased the tolerance
skhilton Jan 12, 2019
b342c2d
removed tolerance in model adequacy test
skhilton Jan 15, 2019
8127b78
fixed typo in test
skhilton Jan 15, 2019
07ba729
ignore multiprocessing test
skhilton Jan 25, 2019
7961c23
switched to NP data
skhilton Jan 25, 2019
1a31622
reduced number of simulations
skhilton Jan 25, 2019
9b8f0e5
changed multiprocessing test to NP data
skhilton Jan 25, 2019
092e76c
removed obsolete input data directory
skhilton Jan 25, 2019
5eef07b
removed old files
skhilton Jan 25, 2019
9a5bc07
utilize full paths for RAxML
skhilton Jan 31, 2019
a2c4c72
added RMSD metric to phydms_modeladequacy
skhilton Feb 1, 2019
5f6cdbf
updated tests to include RMSD results
skhilton Feb 1, 2019
5348031
added max number of simulations per CPU
skhilton Feb 13, 2019
72c4ddf
fixed inability to handle a large number of simulations
skhilton Feb 14, 2019
39229db
Added gammaomega and empirical Bayes capabilities to phydms_comprehen…
jon-mah Feb 14, 2019
822b33e
Split phydms_comprehensive tests into two, added --ncats flag functio…
jon-mah Feb 15, 2019
223b66b
shortened diff prefs test
skhilton Feb 16, 2019
7bdfef8
Added test cases for divpressure. Tests expected to fail.
jon-mah Mar 7, 2019
77f5f0b
Added minimum branch length argument.
Jan 7, 2020
dd2fff8
resolved merge conflict.
Jan 7, 2020
1352dd4
attempted to shorten tests
skhilton May 27, 2020
ba4521e
tweaked xvfb line in .travis.yml
skhilton May 27, 2020
17e594d
added expected diffprefs file
skhilton May 27, 2020
000e946
use more pandas function for empirical bayes
skhilton May 27, 2020
83a4639
fixed bug in positive selection calculations
skhilton May 27, 2020
10ee00f
fixed comment
skhilton May 27, 2020
ed80a47
Merge branch 'REL' into REL_merge
skhilton May 29, 2020
b24fdc1
fixed bugs introduced during merge
skhilton May 29, 2020
97b39ef
removed model adequacy protocol
skhilton May 29, 2020
fdda0f8
cleaned up phydms_comprehensive test
skhilton May 29, 2020
c2179cf
added branch to travis CI
skhilton May 29, 2020
9f3066f
removed call to model adequacy in test
skhilton May 29, 2020
869c50f
removed model adequacy call from another test
skhilton May 29, 2020
2bbdafb
pytest ignore deprecation warnings
skhilton May 29, 2020
448e311
Added documentation in .rst format for REL method.
jon-mah May 30, 2020
af5c892
fixed typos in REL method docs.
jon-mah May 30, 2020
52d7f06
update CHANGELOG and version number to 2.4.0
jbloom May 30, 2020
63a1422
remove `REL` and `REL_merge` branches from Travis tests now that bein…
jbloom May 30, 2020
20d436f
require python >= 3.6 (we are only testing on this)
jbloom May 30, 2020
c96b2c5
clean up docstring
jbloom May 30, 2020
54fc59a
clean up docstring
jbloom May 30, 2020
b91540d
clean up ExpCM docs
jbloom May 30, 2020
55cedac
split empirical_bayes flag into two separate arguments, random_effect…
jon-mah Jun 15, 2020
1119769
small tweaks to parseargs
skhilton Jun 16, 2020
3dc271e
added REL checks to the model check portion of phydms
skhilton Jun 16, 2020
1864169
tweaks to phydms_comprehensive test
skhilton Jun 16, 2020
6a53bf2
phydms_prog for random_effects_likelihood and REL_ncats options.
jon-mah Jun 25, 2020
ad03e53
Merge branch 'REL_merge' of https://github.com/jbloomlab/phydms into …
jon-mah Jun 25, 2020
f09fb50
Merge branch 'master' into REL_merge
skhilton Jun 25, 2020
d01985c
Merge branch 'master' into REL_merge.
jon-mah Jun 25, 2020
42b5350
phdyms_prog docs for REL output files.
jon-mah Jun 25, 2020
850db42
Merge branch 'REL_merge' of https://github.com/jbloomlab/phydms into …
skhilton Jun 25, 2020
b1793ce
tweaks to phydms_prog
skhilton Jun 25, 2020
30e78d5
draft docs for numerical implementation of REL method.
jon-mah Jun 26, 2020
585ccef
removed REL from implementation
skhilton Jun 26, 2020
62b8554
changed CLI to omega_random_effects_likelihood
skhilton Jul 1, 2020
3f4dd06
slight doc tweaks
skhilton Jul 1, 2020
405d91e
changed column titles
skhilton Jul 1, 2020
2e89157
added branch to travis
skhilton Jul 1, 2020
4a1496a
Merge pull request #32 from jbloomlab/REL-names
jon-mah Jul 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changed multiprocessing test to NP data
  • Loading branch information
skhilton committed Jan 25, 2019
commit 0779e2b8d54e9b44fb06feb64fa4d673482f9d46
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[pytest]
addopts = --ignore setup.py --doctest-modules --ignore=docs/plot_diffprefs_prior.py --ignore=tests/test_diffprefsbysite.py --ignore=tests/test_prepalignment.py --ignore=tests/test_phydms_modeladequacy_multiprocessing.py
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`
261 changes: 261 additions & 0 deletions tests/expected_modeladequacy_results/ExpCM_pvalues_seed0_mp.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
site,pvalue,metric,qvalue
65,0.004497751124437781,JensenShannon,0.5847076461769115
4,0.027486256871564217,JensenShannon,0.9985007496251874
93,0.06196901549225387,JensenShannon,0.9985007496251874
8,0.0879560219890055,JensenShannon,0.9985007496251874
92,0.09195402298850575,JensenShannon,0.9985007496251874
50,0.11094452773613193,JensenShannon,0.9985007496251874
60,0.11244377811094453,JensenShannon,0.9985007496251874
108,0.12143928035982009,JensenShannon,0.9985007496251874
98,0.12593703148425786,JensenShannon,0.9985007496251874
41,0.1344327836081959,JensenShannon,0.9985007496251874
97,0.1424287856071964,JensenShannon,0.9985007496251874
12,0.16041979010494753,JensenShannon,0.9985007496251874
114,0.1889055472263868,JensenShannon,0.9985007496251874
18,0.20939530234882558,JensenShannon,0.9985007496251874
94,0.21189405297351324,JensenShannon,0.9985007496251874
34,0.21389305347326337,JensenShannon,0.9985007496251874
14,0.2158920539730135,JensenShannon,0.9985007496251874
25,0.22638680659670166,JensenShannon,0.9985007496251874
120,0.23088455772113944,JensenShannon,0.9985007496251874
80,0.24087956021989004,JensenShannon,0.9985007496251874
21,0.2518740629685157,JensenShannon,0.9985007496251874
56,0.25687156421789104,JensenShannon,0.9985007496251874
83,0.26036981509245377,JensenShannon,0.9985007496251874
102,0.26186906546726635,JensenShannon,0.9985007496251874
52,0.2688655672163918,JensenShannon,0.9985007496251874
40,0.28385807096451776,JensenShannon,0.9985007496251874
76,0.28535732133933034,JensenShannon,0.9985007496251874
115,0.2993503248375812,JensenShannon,0.9985007496251874
37,0.33683158420789605,JensenShannon,0.9985007496251874
79,0.3563218390804598,JensenShannon,0.9985007496251874
106,0.3613193403298351,JensenShannon,0.9985007496251874
51,0.367816091954023,JensenShannon,0.9985007496251874
32,0.36931534232883556,JensenShannon,0.9985007496251874
57,0.38580709645177413,JensenShannon,0.9985007496251874
90,0.3893053473263368,JensenShannon,0.9985007496251874
86,0.39080459770114945,JensenShannon,0.9985007496251874
127,0.3983008495752124,JensenShannon,0.9985007496251874
78,0.3988005997001499,JensenShannon,0.9985007496251874
105,0.41379310344827586,JensenShannon,0.9985007496251874
69,0.42478760619690153,JensenShannon,0.9985007496251874
39,0.4292853573213393,JensenShannon,0.9985007496251874
33,0.4337831084457771,JensenShannon,0.9985007496251874
6,0.43428285857071464,JensenShannon,0.9985007496251874
55,0.4447776111944028,JensenShannon,0.9985007496251874
116,0.44627686156921537,JensenShannon,0.9985007496251874
7,0.45327336331834084,JensenShannon,0.9985007496251874
111,0.47176411794102946,JensenShannon,0.9985007496251874
91,0.4877561219390305,JensenShannon,0.9985007496251874
46,0.48875562218890556,JensenShannon,0.9985007496251874
53,0.5142428785607196,JensenShannon,0.9985007496251874
74,0.5262368815592204,JensenShannon,0.9985007496251874
9,0.5287356321839081,JensenShannon,0.9985007496251874
64,0.5362318840579711,JensenShannon,0.9985007496251874
2,0.5387306346826587,JensenShannon,0.9985007496251874
95,0.545727136431784,JensenShannon,0.9985007496251874
44,0.5502248875562219,JensenShannon,0.9985007496251874
58,0.5562218890554723,JensenShannon,0.9985007496251874
17,0.559720139930035,JensenShannon,0.9985007496251874
72,0.5702148925537232,JensenShannon,0.9985007496251874
87,0.5872063968015993,JensenShannon,0.9985007496251874
84,0.5907046476761619,JensenShannon,0.9985007496251874
88,0.5987006496751625,JensenShannon,0.9985007496251874
15,0.6081959020489756,JensenShannon,0.9985007496251874
26,0.616191904047976,JensenShannon,0.9985007496251874
43,0.6241879060469765,JensenShannon,0.9985007496251874
128,0.624687656171914,JensenShannon,0.9985007496251874
122,0.6331834082958521,JensenShannon,0.9985007496251874
10,0.6341829085457271,JensenShannon,0.9985007496251874
129,0.6351824087956022,JensenShannon,0.9985007496251874
11,0.6506746626686657,JensenShannon,0.9985007496251874
48,0.657671164417791,JensenShannon,0.9985007496251874
19,0.663168415792104,JensenShannon,0.9985007496251874
70,0.665167416291854,JensenShannon,0.9985007496251874
67,0.6721639180409795,JensenShannon,0.9985007496251874
82,0.672663668165917,JensenShannon,0.9985007496251874
117,0.6751624187906047,JensenShannon,0.9985007496251874
110,0.6761619190404797,JensenShannon,0.9985007496251874
68,0.6786606696651675,JensenShannon,0.9985007496251874
1,0.6926536731634183,JensenShannon,0.9985007496251874
5,0.7026486756621689,JensenShannon,0.9985007496251874
30,0.7136431784107946,JensenShannon,0.9985007496251874
54,0.7151424287856072,JensenShannon,0.9985007496251874
3,0.7161419290354822,JensenShannon,0.9985007496251874
22,0.7166416791604198,JensenShannon,0.9985007496251874
29,0.7206396801599201,JensenShannon,0.9985007496251874
35,0.7261369315342329,JensenShannon,0.9985007496251874
73,0.7326336831584208,JensenShannon,0.9985007496251874
89,0.736631684157921,JensenShannon,0.9985007496251874
47,0.7476261869065467,JensenShannon,0.9985007496251874
107,0.7511244377811095,JensenShannon,0.9985007496251874
119,0.7586206896551724,JensenShannon,0.9985007496251874
16,0.7611194402798601,JensenShannon,0.9985007496251874
99,0.7641179410294853,JensenShannon,0.9985007496251874
24,0.7681159420289855,JensenShannon,0.9985007496251874
124,0.7736131934032984,JensenShannon,0.9985007496251874
23,0.7841079460269865,JensenShannon,0.9985007496251874
49,0.784607696151924,JensenShannon,0.9985007496251874
123,0.7896051974012993,JensenShannon,0.9985007496251874
126,0.7931034482758621,JensenShannon,0.9985007496251874
28,0.7936031984007996,JensenShannon,0.9985007496251874
71,0.8010994502748626,JensenShannon,0.9985007496251874
63,0.8055972013993004,JensenShannon,0.9985007496251874
125,0.8205897051474262,JensenShannon,0.9985007496251874
96,0.8235882058970515,JensenShannon,0.9985007496251874
113,0.8295852073963018,JensenShannon,0.9985007496251874
27,0.8435782108945528,JensenShannon,0.9985007496251874
20,0.8545727136431784,JensenShannon,0.9985007496251874
130,0.8590704647676162,JensenShannon,0.9985007496251874
36,0.8990504747626187,JensenShannon,0.9985007496251874
118,0.9015492253873063,JensenShannon,0.9985007496251874
81,0.9025487256371814,JensenShannon,0.9985007496251874
77,0.9075462268865567,JensenShannon,0.9985007496251874
59,0.9150424787606197,JensenShannon,0.9985007496251874
45,0.9195402298850575,JensenShannon,0.9985007496251874
104,0.9220389805097451,JensenShannon,0.9985007496251874
85,0.9430284857571214,JensenShannon,0.9985007496251874
109,0.9460269865067467,JensenShannon,0.9985007496251874
62,0.9655172413793104,JensenShannon,0.9985007496251874
100,0.9705147426286856,JensenShannon,0.9985007496251874
121,0.9760119940029985,JensenShannon,0.9985007496251874
13,0.9765117441279361,JensenShannon,0.9985007496251874
75,0.9795102448775612,JensenShannon,0.9985007496251874
66,0.9825087456271864,JensenShannon,0.9985007496251874
112,0.9855072463768116,JensenShannon,0.9985007496251874
61,0.9885057471264368,JensenShannon,0.9985007496251874
101,0.991504247876062,JensenShannon,0.9985007496251874
42,0.9960019990004998,JensenShannon,0.9985007496251874
31,0.9960019990004998,JensenShannon,0.9985007496251874
103,0.9970014992503748,JensenShannon,0.9985007496251874
38,0.9985007496251874,JensenShannon,0.9985007496251874
65,0.004497751124437781,half_sum_abs_diff,0.5847076461769115
4,0.027486256871564217,half_sum_abs_diff,0.9985007496251874
93,0.06196901549225387,half_sum_abs_diff,0.9985007496251874
8,0.0879560219890055,half_sum_abs_diff,0.9985007496251874
92,0.09195402298850575,half_sum_abs_diff,0.9985007496251874
60,0.11244377811094453,half_sum_abs_diff,0.9985007496251874
108,0.11794102948525736,half_sum_abs_diff,0.9985007496251874
98,0.12193903048475763,half_sum_abs_diff,0.9985007496251874
41,0.13193403298350825,half_sum_abs_diff,0.9985007496251874
97,0.14192903548225888,half_sum_abs_diff,0.9985007496251874
12,0.15542228885557222,half_sum_abs_diff,0.9985007496251874
114,0.18440779610194902,half_sum_abs_diff,0.9985007496251874
50,0.1854072963518241,half_sum_abs_diff,0.9985007496251874
18,0.20889555222388806,half_sum_abs_diff,0.9985007496251874
94,0.21189405297351324,half_sum_abs_diff,0.9985007496251874
14,0.21539230384807595,half_sum_abs_diff,0.9985007496251874
34,0.2178910544727636,half_sum_abs_diff,0.9985007496251874
25,0.22638680659670166,half_sum_abs_diff,0.9985007496251874
120,0.23088455772113944,half_sum_abs_diff,0.9985007496251874
80,0.23088455772113944,half_sum_abs_diff,0.9985007496251874
21,0.248375812093953,half_sum_abs_diff,0.9985007496251874
56,0.25687156421789104,half_sum_abs_diff,0.9985007496251874
83,0.25987006496751625,half_sum_abs_diff,0.9985007496251874
102,0.26186906546726635,half_sum_abs_diff,0.9985007496251874
115,0.2993503248375812,half_sum_abs_diff,0.9985007496251874
40,0.30634682658670664,half_sum_abs_diff,0.9985007496251874
37,0.33683158420789605,half_sum_abs_diff,0.9985007496251874
79,0.3563218390804598,half_sum_abs_diff,0.9985007496251874
51,0.36031984007996004,half_sum_abs_diff,0.9985007496251874
106,0.3613193403298351,half_sum_abs_diff,0.9985007496251874
32,0.36931534232883556,half_sum_abs_diff,0.9985007496251874
90,0.3803098450774613,half_sum_abs_diff,0.9985007496251874
57,0.3853073463268366,half_sum_abs_diff,0.9985007496251874
86,0.3893053473263368,half_sum_abs_diff,0.9985007496251874
78,0.3988005997001499,half_sum_abs_diff,0.9985007496251874
69,0.42478760619690153,half_sum_abs_diff,0.9985007496251874
33,0.4257871064467766,half_sum_abs_diff,0.9985007496251874
39,0.4257871064467766,half_sum_abs_diff,0.9985007496251874
6,0.43428285857071464,half_sum_abs_diff,0.9985007496251874
55,0.44227886056971516,half_sum_abs_diff,0.9985007496251874
116,0.4497751124437781,half_sum_abs_diff,0.9985007496251874
7,0.45327336331834084,half_sum_abs_diff,0.9985007496251874
111,0.4662668665667166,half_sum_abs_diff,0.9985007496251874
46,0.48875562218890556,half_sum_abs_diff,0.9985007496251874
91,0.49775112443778113,half_sum_abs_diff,0.9985007496251874
127,0.5122438780609695,half_sum_abs_diff,0.9985007496251874
53,0.5142428785607196,half_sum_abs_diff,0.9985007496251874
52,0.5177411294352824,half_sum_abs_diff,0.9985007496251874
9,0.5232383808095952,half_sum_abs_diff,0.9985007496251874
74,0.526736631684158,half_sum_abs_diff,0.9985007496251874
64,0.5362318840579711,half_sum_abs_diff,0.9985007496251874
2,0.5387306346826587,half_sum_abs_diff,0.9985007496251874
95,0.5432283858070964,half_sum_abs_diff,0.9985007496251874
44,0.5472263868065967,half_sum_abs_diff,0.9985007496251874
58,0.5562218890554723,half_sum_abs_diff,0.9985007496251874
72,0.5702148925537232,half_sum_abs_diff,0.9985007496251874
17,0.5782108945527237,half_sum_abs_diff,0.9985007496251874
84,0.5867066466766616,half_sum_abs_diff,0.9985007496251874
87,0.5872063968015993,half_sum_abs_diff,0.9985007496251874
15,0.6021989005497251,half_sum_abs_diff,0.9985007496251874
88,0.6081959020489756,half_sum_abs_diff,0.9985007496251874
128,0.6101949025487257,half_sum_abs_diff,0.9985007496251874
26,0.616191904047976,half_sum_abs_diff,0.9985007496251874
43,0.6221889055472264,half_sum_abs_diff,0.9985007496251874
122,0.6301849075462269,half_sum_abs_diff,0.9985007496251874
10,0.6326836581709145,half_sum_abs_diff,0.9985007496251874
11,0.6506746626686657,half_sum_abs_diff,0.9985007496251874
48,0.6551724137931034,half_sum_abs_diff,0.9985007496251874
129,0.655672163918041,half_sum_abs_diff,0.9985007496251874
117,0.6601699150424788,half_sum_abs_diff,0.9985007496251874
82,0.6626686656671664,half_sum_abs_diff,0.9985007496251874
19,0.663168415792104,half_sum_abs_diff,0.9985007496251874
70,0.664167916041979,half_sum_abs_diff,0.9985007496251874
67,0.6691654172913544,half_sum_abs_diff,0.9985007496251874
110,0.6761619190404797,half_sum_abs_diff,0.9985007496251874
68,0.6806596701649176,half_sum_abs_diff,0.9985007496251874
1,0.6911544227886057,half_sum_abs_diff,0.9985007496251874
22,0.6991504247876063,half_sum_abs_diff,0.9985007496251874
5,0.7016491754122939,half_sum_abs_diff,0.9985007496251874
3,0.7086456771614192,half_sum_abs_diff,0.9985007496251874
30,0.7136431784107946,half_sum_abs_diff,0.9985007496251874
54,0.7161419290354822,half_sum_abs_diff,0.9985007496251874
29,0.7251374312843578,half_sum_abs_diff,0.9985007496251874
73,0.7256371814092953,half_sum_abs_diff,0.9985007496251874
35,0.7261369315342329,half_sum_abs_diff,0.9985007496251874
89,0.7346326836581709,half_sum_abs_diff,0.9985007496251874
47,0.7456271864067966,half_sum_abs_diff,0.9985007496251874
107,0.7511244377811095,half_sum_abs_diff,0.9985007496251874
119,0.7556221889055472,half_sum_abs_diff,0.9985007496251874
16,0.7611194402798601,half_sum_abs_diff,0.9985007496251874
99,0.7641179410294853,half_sum_abs_diff,0.9985007496251874
24,0.7641179410294853,half_sum_abs_diff,0.9985007496251874
124,0.7736131934032984,half_sum_abs_diff,0.9985007496251874
23,0.7811094452773614,half_sum_abs_diff,0.9985007496251874
49,0.784607696151924,half_sum_abs_diff,0.9985007496251874
126,0.7866066966516742,half_sum_abs_diff,0.9985007496251874
123,0.7901049475262368,half_sum_abs_diff,0.9985007496251874
71,0.7986006996501749,half_sum_abs_diff,0.9985007496251874
28,0.800599700149925,half_sum_abs_diff,0.9985007496251874
63,0.8055972013993004,half_sum_abs_diff,0.9985007496251874
125,0.8065967016491754,half_sum_abs_diff,0.9985007496251874
96,0.8225887056471765,half_sum_abs_diff,0.9985007496251874
113,0.8295852073963018,half_sum_abs_diff,0.9985007496251874
27,0.8340829585207397,half_sum_abs_diff,0.9985007496251874
20,0.8545727136431784,half_sum_abs_diff,0.9985007496251874
130,0.856071964017991,half_sum_abs_diff,0.9985007496251874
36,0.8990504747626187,half_sum_abs_diff,0.9985007496251874
118,0.9000499750124937,half_sum_abs_diff,0.9985007496251874
81,0.9005497251374313,half_sum_abs_diff,0.9985007496251874
59,0.9150424787606197,half_sum_abs_diff,0.9985007496251874
85,0.9175412293853074,half_sum_abs_diff,0.9985007496251874
45,0.9195402298850575,half_sum_abs_diff,0.9985007496251874
104,0.9220389805097451,half_sum_abs_diff,0.9985007496251874
77,0.9235382308845578,half_sum_abs_diff,0.9985007496251874
105,0.9410294852573713,half_sum_abs_diff,0.9985007496251874
109,0.9445277361319341,half_sum_abs_diff,0.9985007496251874
100,0.9465267366316842,half_sum_abs_diff,0.9985007496251874
62,0.9615192403798101,half_sum_abs_diff,0.9985007496251874
121,0.9760119940029985,half_sum_abs_diff,0.9985007496251874
13,0.9765117441279361,half_sum_abs_diff,0.9985007496251874
101,0.9785107446276862,half_sum_abs_diff,0.9985007496251874
76,0.9795102448775612,half_sum_abs_diff,0.9985007496251874
75,0.9795102448775612,half_sum_abs_diff,0.9985007496251874
66,0.9800099950024987,half_sum_abs_diff,0.9985007496251874
112,0.9855072463768116,half_sum_abs_diff,0.9985007496251874
61,0.9875062468765617,half_sum_abs_diff,0.9985007496251874
103,0.9955022488755623,half_sum_abs_diff,0.9985007496251874
42,0.9960019990004998,half_sum_abs_diff,0.9985007496251874
31,0.9960019990004998,half_sum_abs_diff,0.9985007496251874
38,0.9985007496251874,half_sum_abs_diff,0.9985007496251874
35 changes: 14 additions & 21 deletions tests/test_phydms_modeladequacy_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,33 @@ class test_modeladequacy_ExpCM_mp(unittest.TestCase):
"""Runs model adequacy on an ExpCM with >1 CPU."""
# run parameters
MODEL = "ExpCM_{0}".format(os.path.join(os.path.abspath(os.path.dirname(__file__)),
"modeladequacy_tests/HA_short_prefs_nsites10.csv"))
"NP_data/NP_prefs_short.csv"))
EXPECTED = os.path.join(os.path.abspath(os.path.dirname(__file__)),
"expected_modeladequacy_results/ExpCM_pvalues_seed0_2000rep_pvalues.csv")
SEED = 0
"expected_modeladequacy_results/ExpCM_pvalues_seed0_mp.csv")
TREE = os.path.join(os.path.abspath(os.path.dirname(__file__)),
"modeladequacy_tests/HA_short_nsites10_nseqs34_tree.newick")
NCPUS = 4
"NP_data/NP_tree_short.newick")
NCPUS = 2

def test_modeladequacy(self):
"""Runs model adequacy and compares against expected results."""
"""Runs model adequacy and compares against expected results."""
n_sim = 2000
seed = 0
alignment = os.path.join(os.path.abspath(os.path.dirname(__file__)),
"modeladequacy_tests/HA_short_nsites10_nseqs34.fasta")
"NP_data/NP_alignment_short.fasta")
outprefix = os.path.join(os.path.abspath(os.path.dirname(__file__)),
"_model_adequacy_results")
cmd = ["phydms_modeladequacy", outprefix, alignment,
self.MODEL, "--number_simulations", str(n_sim), "--tree",
self.TREE, "--seed", str(self.SEED), "--ncpus", str(self.NCPUS)]
self.TREE, "--seed", str(seed), "--ncpus", str(self.NCPUS)]
subprocess.check_call(cmd)

final = (pd.read_csv("{0}_pvalues.csv".format(outprefix))
.sort_values(by=["site", "metric"]))
expected = (pd.read_csv(self.EXPECTED)
.sort_values(by=["site", "metric"]))

self.assertTrue(scipy.allclose(final["pvalue"], expected["pvalue"], atol=1e-2),
" pvalue: Expected \n{0}\n \nvs.\n \n{1}.".format(
expected["pvalue"].to_string(),
final["pvalue"].to_string()))
self.assertTrue(scipy.allclose(final["qvalue"], expected["qvalue"], atol=1e-2),
" qvalue: Expected \n{0}\n \nvs.\n \n{1}.".format(
expected["qvalue"].to_string(),
final["qvalue"].to_string()))
final = (pd.read_csv("{0}_pvalues.csv".format(outprefix)))
expected = (pd.read_csv(self.EXPECTED))
merged = pd.merge(final, expected, on=["site", "metric"], how='outer', suffixes=('_final', '_expected'))
merged = merged[["site", "metric", "pvalue_final", "pvalue_expected", "qvalue_final", "qvalue_expected"]]
self.assertTrue(scipy.allclose(merged["pvalue_expected"],
merged["pvalue_final"], atol=1e-3),
"Unexpected results: \n{0}".format(merged))

# remove files
for fname in glob.glob("{0}_*".format(outprefix)):
Expand Down