tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Backwards

Open petrelharp opened this issue 1 year ago • 2 comments

In working out an algorithm that wants to move back through time, it seemed helpful to do a simple explainer on iterating back in time - i.e., taking the haplotype view instead of the tree-by-tree view.

This is a draft of that. Suggestions for nicer python or fun examples welcome! So far it's not demonstrating anything that you couldn't do tree-by-tree.

petrelharp avatar Jul 01 '24 22:07 petrelharp

Nice. I like this. Note that there are a few examples of iterating up and down the graph at https://tskit.dev/tutorials/args.html#graph-traversal, but I don't actually do anything with the traversals, so your examples are better.

Also note that some of stuff might also link in to https://github.com/tskit-dev/tskit/discussions/2869, and there are some suggestions of things you might want to calculate there. One thing that is much easier to do compared to the tree-by-tree approach is to find all the descendant samples of a particular ancestral node (or alternatively, all the internal nodes that are ancestors of a particular sample).

hyanwong avatar Jul 01 '24 22:07 hyanwong

Is this changed at all by the new ARG interface in Tskit 1.0?

hyanwong avatar Oct 26 '25 19:10 hyanwong