Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,7 @@ tmp__NOBACKUP__
.DS_Store

# vscode stuff
.vscode
.vscode

# verfification files
verification/*
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions data/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 16 additions & 11 deletions verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def write_slim_script(outfile, format_dict):
initializeRecombinationRate({RHO});
}}
// create a population
1
1 early()
{{
{POP_STRS};
sim.tag = 0;
Expand All @@ -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}');
Expand Down Expand Up @@ -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});
Expand All @@ -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() {{
Expand All @@ -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});
}}
}}
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down