tskit: kc_distance doesn't ignore unary nodes

We should presumably have the same KC distance regardless of unary nodes. But the example below shows that it doesn’t work:

# use record_full_arg to leave in some unary nodes
ts_unary = msprime.simulate(10, random_seed=1, recombination_rate=10, record_full_arg=True)

tree02 = ts_unary.at(0.2)
tree08 = ts_unary.at(0.8)
kc_unary = tree02.kc_distance(tree08)

ts_nounary = ts_unary.simplify()

tree02 = ts_nounary.at(0.2)
tree08 = ts_nounary.at(0.8)
kc_nounary = tree02.kc_distance(tree08)

assert kc_unary == kc_nounary  # currently fails

ping @daniel-goldstein as he’s working on KC distance calcs at the moment.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

Ok, I’ll just throw an error for unary nodes.

I’d be happy to take it!

I’m inclined to leave this to @daniel-goldstein to fix, if he’s happy with that, as he is working on the code at the moment. Is that OK Daniel? Happy to take it on if not, though.