This changes MAT::collapse_tree to add child's mutations to its parent node when collapsing, instead of adding parent node's mutations to its child which violated the order expected by Node::add_mutations. This also adds an error check in add_mutations that would have caught the bug. (In effect it was asked to evaluate A23013G > C23013A which doesn't make sense because G != C. Now, the intended C23013A > A23013G is passed in from collapse_tree.)
I tested this on the test case from #308 and now the collapsed path includes C23013G as it should:
This changes MAT::collapse_tree to add child's mutations to its parent node when collapsing, instead of adding parent node's mutations to its child which violated the order expected by Node::add_mutations. This also adds an error check in add_mutations that would have caught the bug. (In effect it was asked to evaluate A23013G > C23013A which doesn't make sense because G != C. Now, the intended C23013A > A23013G is passed in from collapse_tree.)
I tested this on the test case from #308 and now the collapsed path includes C23013G as it should: