Creating a tree sequence object within a C API integrated program #2726
-
Hi everyone, My question pertains to creating a valid tree sequence object from a table collection object within a C-based forward in time evolution simulation program intermittently, before the simplification process, to analyze the trees while they contain all genealogical information. The issue I am facing is in the following sequence of pseudocode: table collection object → sort table collection object using tsk_table_collection_sort() → rebuild index of table collection using tsk_table_collection_build_index() → initialize tree sequence object with the table collection object. Is this sequence of pseudocode correct? I understand that I have to sort the table collection object to get a valid tree sequence but sorting drops the index of the table collection object and I can't create a tree sequence object with an unindexed table collection object. Hence, I am building the index and then initializing the tree sequence object. NOTE: These steps are working without any error but the tree sequence object I obtain has 0 num_samples which does not make sense. Is the rebuilding of the index possibly leading to this issue? Thanks for the help! I can provide more information if needed. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
On first glance this seems right. Are any of your nodes marked as sample nodes? (i.e. they have the |
Beta Was this translation helpful? Give feedback.
On first glance this seems right.
Are any of your nodes marked as sample nodes? (i.e. they have the
TSK_NODE_IS_SAMPLE
in theirflags
). It's perfectly valid to have a tree sequence with zero samples as they are just "special" nodes. See https://tskit.dev/tskit/docs/stable/data-model.html#node-table