Bandage icon indicating copy to clipboard operation
Bandage copied to clipboard

Total length not accurate

Open rozovr opened this issue 10 years ago • 2 comments

Hi Ryan,

I just wanted to let you know that when you select a few consecutive nodes the "Total length" reported under "selected nodes" reflects the sum of the lengths of node labels, whereas it should be less - specifically you should deduct the overlap sizes. It looks like this is done correctly when such paths are copied to the clipboard, so I just wanted to suggest having these lengths match up to avoid confusion. I'm seeing this on 0.7.0, so hopefully it's not something you already took care of.

Thanks, R

rozovr avatar Dec 20 '15 11:12 rozovr

Roye,

This is by design, though I'm aware it can be confusing and I'm open to suggestions on how to make it less so.

The way I currently view the issue is this: if you select some nodes, the total length (displayed on the right of the GUI) is just a simple sum of node lengths, ignoring overlaps. If, however, you are extracting sequences for graph paths, then overlaps are taken into account and subtracted to avoid duplicated sequences.

I went with this simplistic approach because I could see multiple different ways to consider overlaps in the total length, and I'm not sure which would be best. In particular, things are not obvious when you have multiple nodes selected which do not form a simple path.

Consider the case where these three nodes are selected:

  B
 /
A
 \
  C

Imagine all three nodes have a length of 100 bp and the two edges have an overlap of 10 bp. If the user selected all three, I can see a few different possibilities:

  • Total length = 300 bp. A simple sum, ignoring overlaps (what Bandage currently does).
  • Total length = 290 bp. Trim the overlap length from node A. The overlap length is removed only once because the two edges share the same overlap.
  • Total length = 280 bp. Trim the overlap length from nodes B and C. The overlap length is removed twice, once for all possible edges connecting nodes in the selection.
  • Only edges which are selected have their overlap removed. This way total length depends not just on the node selection but also on the edge selection. Total length would be 300, 290 or 280, depending on whether 0, 1 or 2 edges were included in the selection.

I went with the first option because it seemed simplest and least confusing to me. But if you can make a case for one of the other options, or suggest an approach I haven't considered, then I'm keen to hear it!

Thanks, Ryan

rrwick avatar Dec 20 '15 23:12 rrwick

Hey Ryan, thanks for considering this.

The second case is not clear to me - can you clarify why the two edges share the same overlap? I think there are two different overlaps since they relate to different ends of A.

Generally, I agree there are cases the length reported can be ambiguous, particularly whenever your path returns to some point that's already been visited, but as it is, the total length is problematic in that it's misleading. For how it is currently, I would think to re-label that length to something like 'sum of node lengths.' To make it clear this is not the same as the path length, maybe consider putting the path selection box under the node selection (at the right) and having a "path length" reported under it.

To me the path selection box is more needed and natural than an additional box showing edge selection. I may be on the fringe in this sense, but I have tended to mostly ignore the selectable edges, so in my view the edge selection box may be superfluous. It would be interesting to see if others think the same.

R

rozovr avatar Dec 21 '15 07:12 rozovr