nextstrain / auspice

Web app for visualizing pathogen evolution
https://docs.nextstrain.org/projects/auspice/
GNU Affero General Public License v3.0
292 stars 162 forks source link

BUG: Deletion->Undeletion appears as double deletion in tip-tooltip #1640

Open corneliusroemer opened 1 year ago

corneliusroemer commented 1 year ago

Current Behavior

When the path to a tip contains a deletion and an undeletion, the tooltip for the tip lists 2 "gaps" when in fact one is a deletion, the other is an undeletion. So logically, they should either cancel out, or they should be shown separately as cancelled deletion.

Listing the undeletion as a gap is unsound, it messes with the sum of gaps (an undeletion is either an insertion, or it cancels the previous deletion - a 3bp deletion should hence either not count at all towards "sum of gapped bases" or count as 3bp, but never 6 bp).

Screenshot 2023-03-13 at 09 22 49

Note that the actual deletions in the tip sequence sum to 22 - not 26. And that there are 5 - not 7 - gaps, if one looks at the tip alone, ignoring the path (which I think is what one would expect the tip view to do?)

Expected behavior

Three options:

Context

Auspice 2.44.0

jameshadfield commented 1 year ago

I'm having trouble reproducing this. I've created a small tree to try to reproduce, which flags up some oddities, but I can't reproduce a duplicated gap region. Could you identify the tree & tip you're using for this issue, or better yet add an example to the attached tree?

generic.json.txt

The footer in this little tree describes some test gaps + reversions. One thing that gets flagged up is that gaps replaced by bases are considered "undeletions", no matter if the replacement base matches the ancestral one (i.e. A10- + -10T = undeletion). I think that's more minor than what you're seeing, so I'll tackle your bug first.