Skip to content
Closed
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,6 @@ tmp__NOBACKUP__
.DS_Store

# vscode stuff
.vscode
.vscode
git-submodules
lib/subprojects
6 changes: 3 additions & 3 deletions lib/dev-tools/dev-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ run_simulate(
record_provenance(&tables.provenances);

msp_print_state(&msp, stdout);
msp_verify(&msp, MSP_VERIFY_BREAKPOINTS);
//msp_verify(&msp, MSP_VERIFY_BREAKPOINTS);
for (j = 0; j < num_replicates; j++) {
if (verbose >= 1) {
printf("=====================\n");
Expand All @@ -812,15 +812,15 @@ run_simulate(
if (ret != 0) {
fatal_msprime_error(ret, __LINE__);
}
msp_verify(&msp, 0);
//msp_verify(&msp, 0);
ret = msp_run(&msp, DBL_MAX, UINT32_MAX);
if (ret < 0) {
fatal_msprime_error(ret, __LINE__);
}
if (verbose >= 1) {
msp_print_state(&msp, stdout);
}
msp_verify(&msp, 0);
//msp_verify(&msp, 0);
ret = msp_finalise_tables(&msp);

if (ret != 0) {
Expand Down
4 changes: 2 additions & 2 deletions lib/msprime.c
Original file line number Diff line number Diff line change
Expand Up @@ -2113,7 +2113,7 @@ msp_verify(msp_t *self, int options)
if (self->model.type == MSP_MODEL_WF_PED) {
msp_verify_pedigree(self);
}
if (self->model.type == MSP_MODEL_SMC_K) {
if ((self->model.type == MSP_MODEL_SMC_K)) {
msp_verify_hulls(self);
}
}
Expand Down Expand Up @@ -2371,7 +2371,7 @@ msp_print_state(msp_t *self, FILE *out)
fprintf(out, "lineage_heap:");
object_heap_print_state(&self->lineage_heap, out);
fflush(out);
msp_verify(self, 0);
//msp_verify(self, 0);
out:
if (ancestors != NULL) {
free(ancestors);
Expand Down
26 changes: 21 additions & 5 deletions verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -3823,16 +3823,20 @@ 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),
msprime.SmcKApproxCoalescent(hull_offset=0)
]
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
[len(models), gc_length_rate_ratio.size, seq_length], dtype=float
)
empirical_prob_mid = np.zeros(
[2, gc_length_rate_ratio.size, seq_length], dtype=float
[len(models), gc_length_rate_ratio.size, seq_length], dtype=float
)
empirical_prob_last = np.zeros(
[2, gc_length_rate_ratio.size, seq_length], dtype=float
[len(models), gc_length_rate_ratio.size, seq_length], dtype=float
)

for k, l in enumerate(gc_length):
Expand Down Expand Up @@ -3876,7 +3880,8 @@ def test_gc_correlation_between_trees(self):
x = np.arange(500) + 1
pyplot.plot(x, predicted_prob[0], "--", label="prediction")
pyplot.plot(x, empirical_prob_first[0, 0], "-", label="simulation hudson")
pyplot.plot(x, empirical_prob_first[1, 0], ":", label="simulation smc-k")
pyplot.plot(x, empirical_prob_first[1, 0], ":", label="simulation smc-k (k=seq_len)")
pyplot.plot(x, empirical_prob_first[2, 0], ".", label="simulation smc-k (k=0)")
pyplot.plot(x, predicted_prob[1], "--")
pyplot.plot(x, empirical_prob_first[0, 1], "-")
pyplot.plot(x, empirical_prob_first[1, 1], ":")
Expand All @@ -3892,6 +3897,7 @@ def test_gc_correlation_between_trees(self):
pyplot.plot(x, predicted_prob[0, ::-1], "--", label="prediction")
pyplot.plot(x, empirical_prob_last[0, 0], "-", label="simulation hudson")
pyplot.plot(x, empirical_prob_last[1, 0], ":", label="simulation smc-k")
pyplot.plot(x, empirical_prob_last[2, 0], ".", label="simulation smc-k (k=0)")
pyplot.plot(x, predicted_prob[1, ::-1], "--")
pyplot.plot(x, empirical_prob_last[0, 1], "-")
pyplot.plot(x, empirical_prob_last[1, 1], ":")
Expand All @@ -3912,20 +3918,24 @@ def test_gc_correlation_between_trees(self):
)
pyplot.plot(x, empirical_prob_mid[0, 0], "-", label="simulation hudson")
pyplot.plot(x, empirical_prob_mid[1, 0], ":", label="simulation smc-k")
pyplot.plot(x, empirical_prob_mid[2, 0], ".", label="simulation smc-k (k=0)")

pyplot.plot(
x,
np.concatenate((predicted_prob[1, 249::-1], predicted_prob[1, :250])),
"--",
)
pyplot.plot(x, empirical_prob_mid[0, 1], "-")
pyplot.plot(x, empirical_prob_mid[1, 1], ":")
pyplot.plot(x, empirical_prob_mid[2, 1], ".")
pyplot.plot(
x,
np.concatenate((predicted_prob[2, 249::-1], predicted_prob[2, :250])),
"--",
)
pyplot.plot(x, empirical_prob_mid[0, 2], "-")
pyplot.plot(x, empirical_prob_mid[1, 2], ":")
pyplot.plot(x, empirical_prob_mid[2, 2], ".")
pyplot.xlabel("chromosome positon")
pyplot.ylabel("fraction of trees identical to middle position tree")
pyplot.legend(loc="upper right")
Expand All @@ -3940,12 +3950,18 @@ def test_gc_correlation_between_trees(self):
pyplot.plot(
x, empirical_prob_first[1, 0, range(10)], ":", label="simulation smc-k"
)
pyplot.plot(
x, empirical_prob_first[2, 0, range(10)], ".", label="simulation smc-k (k=0)"
)
pyplot.plot(x, predicted_prob[1, range(10)], "--")
pyplot.plot(x, empirical_prob_first[0, 1, range(10)], "-")
pyplot.plot(x, empirical_prob_first[1, 1, range(10)], ":")
pyplot.plot(x, empirical_prob_first[2, 1, range(10)], ".")
pyplot.plot(x, predicted_prob[2, range(10)], "--")
pyplot.plot(x, empirical_prob_first[0, 2, range(10)], "-")
pyplot.plot(x, empirical_prob_first[1, 2, range(10)], ":")
pyplot.plot(x, empirical_prob_first[2, 2, range(10)], ".")

pyplot.xlabel("chromosome positon")
pyplot.ylabel("fraction of trees identical to first position tree")
pyplot.legend(loc="upper right")
Expand Down
Loading