matsengrp / historydag

https://matsengrp.github.io/historydag
GNU General Public License v3.0
0 stars 1 forks source link

One Sided RF distances #80

Closed willdumm closed 11 months ago

willdumm commented 11 months ago

This PR includes @clarisw's contributions of computation of one-sided RF distances in the history DAG. I rearranged the implementation so that all of the new code is contained in utils.make_rfdistance_countfuncs. Left and right one-sided RF distances are available through the new keyword argument one_sided, which takes either left, right, or None. The docstring explains what these options mean, hopefully in enough detail to figure out which one is needed.

I also extended these additions to the sum RF distance countfuncs function in utils, as well as the sum and average RF distance methods on the whole DAG.

In addition, all dag methods for RF distance and now accept and forward these new keyword arguments to the appropriate countfunc function. All methods are tested as before, first using a ground-truth method (counting clades or ete's RF distance implementation) and building up transitively to the whole-dag sums, but now each step includes checks for left, right, and standard rooted-and-unrooted-RF distances

willdumm commented 11 months ago

For reference, the computations that are used to implement this are here (starting page 5 I think) https://github.com/matsengrp/hdag-benchmark-tex/blob/2ed26a8ae7130af867738fdda55bb3ee5d811357/node-support.pdf

The constants a and b in the writeup correspond to the constants s and t in the code.