From 5d60e6f0032f4999f0cb8d146faf59923eb6ea49 Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Thu, 19 Jan 2023 20:22:35 +0000 Subject: [PATCH] Mark samples and index tables --- c/examples/haploid_wright_fisher.c | 6 ++++++ c/examples/multichrom_wright_fisher.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/c/examples/haploid_wright_fisher.c b/c/examples/haploid_wright_fisher.c index 285e939d7f..5689fefc7a 100644 --- a/c/examples/haploid_wright_fisher.c +++ b/c/examples/haploid_wright_fisher.c @@ -92,6 +92,12 @@ main(int argc, char **argv) check_tsk_error(ret); srand((unsigned)atoi(argv[5])); simulate(&tables, atoi(argv[1]), atoi(argv[2]), atoi(argv[3])); + + /* Sort and index so that the result can be opened as a tree sequence */ + ret = tsk_table_collection_sort(&tables, NULL, 0); + check_tsk_error(ret); + ret = tsk_table_collection_build_index(&tables, 0); + check_tsk_error(ret); ret = tsk_table_collection_dump(&tables, argv[4], 0); check_tsk_error(ret); diff --git a/c/examples/multichrom_wright_fisher.c b/c/examples/multichrom_wright_fisher.c index 2a0b43d288..1155bb5a1d 100644 --- a/c/examples/multichrom_wright_fisher.c +++ b/c/examples/multichrom_wright_fisher.c @@ -243,6 +243,10 @@ simulate( simplify_tables(tcs, num_chunks, children, N); } } + /* Set the sample flags for final generation */ + for (j = 0; j < N; j++) { + tcs[0].nodes.flags[children[j]] = TSK_NODE_IS_SAMPLE; + } free(buffer); }