Skip to content

Command line for diff for tree sequences? #1115

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

You must be logged in to vote

Yes! tskit will do this. To get a simple example:

import msprime
ts = msprime.simulate(6, recombination_rate=1.0)
sts = ts.simplify(range(4))
ts.dump("ts.trees")
sts.dump("sts.trees")

Now, we can look at the node tables like so:

$ tskit nodes sts.trees
id	is_sample	time	population	individual	metadata
0	1	0.000000	0	-1	
1	1	0.000000	0	-1	
2	1	0.000000	0	-1	
3	1	0.000000	0	-1	
4	0	0.099054	0	-1	
5	0	0.873640	0	-1	
6	0	2.301402	0	-1	
7	0	3.290248	0	-1	
8	0	3.582909	0	-1	
9	0	3.757544	0	-1	
10	0	4.407859	0	-1

and so we can do a "diff" like this:

for x in info individuals nodes edges sites mutations populations provenances
do
    echo $x
    diff <(tskit $x ts.trees) <(tskit $x sts.trees)
done

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by benjeffery
Comment options

You must be logged in to vote
2 replies
@benjeffery
Comment options

@petrelharp
Comment options

petrelharp Jan 14, 2021
Maintainer Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants