diff --git a/.gitignore b/.gitignore index 1e0d02841..438925560 100644 --- a/.gitignore +++ b/.gitignore @@ -95,4 +95,7 @@ tmp__NOBACKUP__ .DS_Store # vscode stuff -.vscode \ No newline at end of file +.vscode + +# verfification files +verification/* diff --git a/Makefile b/Makefile index 232c898a4..974589a37 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,10 @@ clang-format: tags: ctags -f TAGS msprime/*.c lib/*.[c,h] msprime/*.py tests/*.py algorithms.py +verification: + pip install -e ".[verification]" + $(MAKE) -C data + python verification.py -t 4 -d verification clean: rm -fR build diff --git a/data/Makefile b/data/Makefile index 2986b9cdd..b9b499204 100644 --- a/data/Makefile +++ b/data/Makefile @@ -1,4 +1,4 @@ -all: scrm ms msHOT slim seq-gen msms msprime-0.7.4 +all: scrm ms msHOT slim seq-gen msms msprime-0.7.4 discoal seq-gen: rm -fR seq-gen Seq-Gen* 1.3.4.tar.gz @@ -9,12 +9,12 @@ seq-gen: slim: rm -fR SLiM* - wget https://github.com/MesserLab/SLiM/archive/refs/tags/v3.7.1.tar.gz - tar -zxvf v3.7.1.tar.gz - mkdir SLiM-3.7.1/build + wget https://github.com/MesserLab/SLiM/archive/refs/tags/v5.1.tar.gz + tar -zxvf v5.1.tar.gz + mkdir SLiM-5.1/build # Arbitrarily using 4 threads to build here.. - cd SLiM-3.7.1/build && cmake .. && make -j 4 - cp SLiM-3.7.1/build/slim ./ + cd SLiM-5.1/build && cmake .. && make -j 4 + cp SLiM-5.1/build/slim ./ scrm: wget https://github.com/scrm/scrm/releases/download/v1.7.2/scrm-src.tar.gz diff --git a/docs/development.md b/docs/development.md index 6bdfa8adc..788ee7438 100644 --- a/docs/development.md +++ b/docs/development.md @@ -760,6 +760,15 @@ directory. Please read the comments at the top of the `verification.py` script for details on how to write and run these tests. +The make rule `verification` bundles the three steps in one command: installs the dependencies, +compiles customised versions of `ms` (and other tools), and runs all the tests sequentially. + +To invoke this rule run the command: +``` +$ make verification +``` +The output should be in the directory: `/verification` + ## Benchmarking Benchmarks to measure performance are in the `benchmarks` folder and are run using diff --git a/verification.py b/verification.py index 7eed79c01..0fa8ce4b6 100644 --- a/verification.py +++ b/verification.py @@ -141,7 +141,7 @@ def write_slim_script(outfile, format_dict): initializeRecombinationRate({RHO}); }} // create a population - 1 + 1 early() {{ {POP_STRS}; sim.tag = 0; @@ -151,11 +151,11 @@ def write_slim_script(outfile, format_dict): {{ if (sim.tag == 0) {{ if (sim.treeSeqCoalesced()) {{ - sim.tag = sim.generation; + sim.tag = sim.cycle; catn(sim.tag + ': COALESCED'); }} }} - if (sim.generation == sim.tag * 10) {{ + if (sim.cycle == sim.tag * 10) {{ sim.simulationFinished(); catn('Ran a further ' + sim.tag * 10 + ' generations'); sim.treeSeqOutput('{OUTFILE}'); @@ -185,7 +185,7 @@ def write_sweep_slim_script(outfile, format_dict): sim.simulationFinished(); }} - 1 {{ + 1 early(){{ // save this run's identifier, used to save and restore defineConstant("simID", getSeed()); sim.addSubpop("p1", {POPSIZE}); @@ -195,7 +195,7 @@ def write_sweep_slim_script(outfile, format_dict): 2 late() {{ // save the state of the simulation sim.treeSeqOutput("/tmp/slim_" + simID + ".trees"); - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, {SWEEPPOS}); }} 2:2000 late() {{ @@ -208,15 +208,15 @@ def write_sweep_slim_script(outfile, format_dict): if (fixed) {{ if (sim.getValue("flag") == 1){{ - sim.rescheduleScriptBlock(s1, - start=sim.generation+{TAU}, end=sim.generation+{TAU}); + community.rescheduleScriptBlock(s1, + start=sim.cycle+{TAU}, end=sim.cycle+{TAU}); }} }} else {{ sim.readFromPopulationFile("/tmp/slim_" + simID + ".trees"); setSeed(rdunif(1, 0, asInteger(2^62) - 1)); - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, {SWEEPPOS}); }} }} @@ -946,9 +946,9 @@ def sample_recap_simplify(slim_ts, sample_size, Ne, r, mu): demography=demography, recombination_rate=r, # TODO is this needed now? Shouldn't be, right? - start_time=slim_ts.metadata["SLiM"]["generation"], + start_time=slim_ts.metadata["SLiM"]["cycle"], ) - logging.debug(f"pyslim: slim generation:{slim_ts.metadata['SLiM']['generation']}") + logging.debug(f"pyslim: slim generation:{slim_ts.metadata['SLiM']['cycle']}") alive_inds = pyslim.individuals_alive_at(recap, 0) keep_indivs = np.random.choice(alive_inds, sample_size, replace=False) keep_nodes = [] @@ -3823,7 +3823,9 @@ def test_gc_correlation_between_trees(self): seq_length = 500 # tests both Hudson as well as SMC K # by setting hull_offset to seq_length are essentially simulating Hudson - models = ["hudson", msprime.SmcKApproxCoalescent(hull_offset=seq_length)] + # models = ["hudson", msprime.SmcKApproxCoalescent(hull_offset=seq_length)] + # GC for smck is currently not supported + models = ["hudson"] predicted_prob = np.zeros([gc_length_rate_ratio.size, seq_length], dtype=float) empirical_prob_first = np.zeros( [2, gc_length_rate_ratio.size, seq_length], dtype=float @@ -4949,6 +4951,8 @@ def test_smck_vs_smckapprox_multiple_bottleneck(self): sequence_length=5e7, ) + ''' + Commented as gc is not yet supported in SmcKApproxCoalescent def test_gc_tract_length_smc(self): """ Runs the check for the mean length of gene conversion tracts. @@ -5132,6 +5136,7 @@ def test_smc_k_num_trees_gc(self): pyplot.tight_layout() pyplot.savefig(self.output_dir / "breakpoints_boxplot.png") pyplot.close() + ''' def test_out_of_africa_migration_model(self): s_no = 10