yatisht / usher

Ultrafast Sample Placement on Existing Trees
MIT License
121 stars 40 forks source link

collapse_tree: preserve order expected by add_mutation #309

Closed AngieHinrichs closed 1 year ago

AngieHinrichs commented 1 year ago

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:

... node_1138105:T22020C,T22054G,G23012A,C23013G,C28550A ...
yatisht commented 1 year ago

Thank you for this fix, @AngieHinrichs!