Skip to content

Commit 3ef9eb2

Browse files
committed
first pass
slim script modifciations and add output to gitignore Update Makefile and development documentation for verification process Comment out test for GC tract length as it is not supported in SmcKApproxCoalescent cycle instead of tick comment smck test for gc
1 parent 7f854ac commit 3ef9eb2

File tree

5 files changed

+39
-18
lines changed

5 files changed

+39
-18
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,7 @@ tmp__NOBACKUP__
9595
.DS_Store
9696

9797
# vscode stuff
98-
.vscode
98+
.vscode
99+
100+
# verfification files
101+
verification/*

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ clang-format:
2727
tags:
2828
ctags -f TAGS msprime/*.c lib/*.[c,h] msprime/*.py tests/*.py algorithms.py
2929

30+
verification:
31+
pip install -e ".[verification]"
32+
$(MAKE) -C data
33+
python verification.py -t 4 -d verification
3034

3135
clean:
3236
rm -fR build

data/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
all: scrm ms msHOT slim seq-gen msms msprime-0.7.4
1+
all: scrm ms msHOT slim seq-gen msms msprime-0.7.4 discoal
22

33
seq-gen:
44
rm -fR seq-gen Seq-Gen* 1.3.4.tar.gz
@@ -9,12 +9,12 @@ seq-gen:
99

1010
slim:
1111
rm -fR SLiM*
12-
wget https://github.com/MesserLab/SLiM/archive/refs/tags/v3.7.1.tar.gz
13-
tar -zxvf v3.7.1.tar.gz
14-
mkdir SLiM-3.7.1/build
12+
wget https://github.com/MesserLab/SLiM/archive/refs/tags/v5.1.tar.gz
13+
tar -zxvf v5.1.tar.gz
14+
mkdir SLiM-5.1/build
1515
# Arbitrarily using 4 threads to build here..
16-
cd SLiM-3.7.1/build && cmake .. && make -j 4
17-
cp SLiM-3.7.1/build/slim ./
16+
cd SLiM-5.1/build && cmake .. && make -j 4
17+
cp SLiM-5.1/build/slim ./
1818

1919
scrm:
2020
wget https://github.com/scrm/scrm/releases/download/v1.7.2/scrm-src.tar.gz

docs/development.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,15 @@ directory.
760760
Please read the comments at the top of the `verification.py` script for details
761761
on how to write and run these tests.
762762

763+
The make rule `verification` bundles the three steps in one command: installs the dependencies,
764+
compiles customised versions of `ms` (and other tools), and runs all the tests sequentially.
765+
766+
To invoke this rule run the command:
767+
```
768+
$ make verification
769+
```
770+
The output should be in the directory: `/verification`
771+
763772
## Benchmarking
764773

765774
Benchmarks to measure performance are in the `benchmarks` folder and are run using

verification.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def write_slim_script(outfile, format_dict):
141141
initializeRecombinationRate({RHO});
142142
}}
143143
// create a population
144-
1
144+
1 early()
145145
{{
146146
{POP_STRS};
147147
sim.tag = 0;
@@ -151,11 +151,11 @@ def write_slim_script(outfile, format_dict):
151151
{{
152152
if (sim.tag == 0) {{
153153
if (sim.treeSeqCoalesced()) {{
154-
sim.tag = sim.generation;
154+
sim.tag = sim.cycle;
155155
catn(sim.tag + ': COALESCED');
156156
}}
157157
}}
158-
if (sim.generation == sim.tag * 10) {{
158+
if (sim.cycle == sim.tag * 10) {{
159159
sim.simulationFinished();
160160
catn('Ran a further ' + sim.tag * 10 + ' generations');
161161
sim.treeSeqOutput('{OUTFILE}');
@@ -185,7 +185,7 @@ def write_sweep_slim_script(outfile, format_dict):
185185
sim.simulationFinished();
186186
}}
187187
188-
1 {{
188+
1 early(){{
189189
// save this run's identifier, used to save and restore
190190
defineConstant("simID", getSeed());
191191
sim.addSubpop("p1", {POPSIZE});
@@ -195,7 +195,7 @@ def write_sweep_slim_script(outfile, format_dict):
195195
2 late() {{
196196
// save the state of the simulation
197197
sim.treeSeqOutput("/tmp/slim_" + simID + ".trees");
198-
target = sample(p1.genomes, 1);
198+
target = sample(p1.haplosomes, 1);
199199
target.addNewDrawnMutation(m2, {SWEEPPOS});
200200
}}
201201
2:2000 late() {{
@@ -208,15 +208,15 @@ def write_sweep_slim_script(outfile, format_dict):
208208
if (fixed)
209209
{{
210210
if (sim.getValue("flag") == 1){{
211-
sim.rescheduleScriptBlock(s1,
212-
start=sim.generation+{TAU}, end=sim.generation+{TAU});
211+
community.rescheduleScriptBlock(s1,
212+
start=sim.cycle+{TAU}, end=sim.cycle+{TAU});
213213
}}
214214
}}
215215
else
216216
{{
217217
sim.readFromPopulationFile("/tmp/slim_" + simID + ".trees");
218218
setSeed(rdunif(1, 0, asInteger(2^62) - 1));
219-
target = sample(p1.genomes, 1);
219+
target = sample(p1.haplosomes, 1);
220220
target.addNewDrawnMutation(m2, {SWEEPPOS});
221221
}}
222222
}}
@@ -946,9 +946,9 @@ def sample_recap_simplify(slim_ts, sample_size, Ne, r, mu):
946946
demography=demography,
947947
recombination_rate=r,
948948
# TODO is this needed now? Shouldn't be, right?
949-
start_time=slim_ts.metadata["SLiM"]["generation"],
949+
start_time=slim_ts.metadata["SLiM"]["cycle"],
950950
)
951-
logging.debug(f"pyslim: slim generation:{slim_ts.metadata['SLiM']['generation']}")
951+
logging.debug(f"pyslim: slim generation:{slim_ts.metadata['SLiM']['cycle']}")
952952
alive_inds = pyslim.individuals_alive_at(recap, 0)
953953
keep_indivs = np.random.choice(alive_inds, sample_size, replace=False)
954954
keep_nodes = []
@@ -3823,7 +3823,9 @@ def test_gc_correlation_between_trees(self):
38233823
seq_length = 500
38243824
# tests both Hudson as well as SMC K
38253825
# by setting hull_offset to seq_length are essentially simulating Hudson
3826-
models = ["hudson", msprime.SmcKApproxCoalescent(hull_offset=seq_length)]
3826+
# models = ["hudson", msprime.SmcKApproxCoalescent(hull_offset=seq_length)]
3827+
# GC for smck is currently not supported
3828+
models = ["hudson"]
38273829
predicted_prob = np.zeros([gc_length_rate_ratio.size, seq_length], dtype=float)
38283830
empirical_prob_first = np.zeros(
38293831
[2, gc_length_rate_ratio.size, seq_length], dtype=float
@@ -4949,6 +4951,8 @@ def test_smck_vs_smckapprox_multiple_bottleneck(self):
49494951
sequence_length=5e7,
49504952
)
49514953

4954+
'''
4955+
Commented as gc is not yet supported in SmcKApproxCoalescent
49524956
def test_gc_tract_length_smc(self):
49534957
"""
49544958
Runs the check for the mean length of gene conversion tracts.
@@ -5132,6 +5136,7 @@ def test_smc_k_num_trees_gc(self):
51325136
pyplot.tight_layout()
51335137
pyplot.savefig(self.output_dir / "breakpoints_boxplot.png")
51345138
pyplot.close()
5139+
'''
51355140

51365141
def test_out_of_africa_migration_model(self):
51375142
s_no = 10

0 commit comments

Comments
 (0)