Skip to content

merging multiple tree sequences into a single demographic model #2421

Answered by petrelharp
mshpak76 asked this question in Q&A
Discussion options

You must be logged in to vote

Copying from the SLiM-discuss list: From [https://tskit.dev/tskit/docs/stable/python-api.html#tskit.TreeSequence.union](the documentation),
"the node_mapping argument should be an array of length equal to the number of nodes in other and whose entries are the ID of the matching node in self, or tskit.NULL if there is no matching node. ". So, in your case you have no shared nodes, i.e., all entries of the node map should be tskit.NULL. So, this works, for instance:

  ts1.union(ts2, [tskit.NULL for _ in ts2.nodes()])

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mshpak76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants