Coder Social home page Coder Social logo

visualizing inversions about bandage HOT 6 OPEN

rrwick avatar rrwick commented on September 13, 2024
visualizing inversions

from bandage.

Comments (6)

rrwick avatar rrwick commented on September 13, 2024

First, as an aside, I'll mention a relatively new Bandage feature: linear graph layout. It applies when your graph has a general linear structure and low-numbered segments tend to precede high-numbered segments. You can turn it on in Bandage's preferences (make sure you have a recent Bandage version):
screen shot 2017-01-27 at 11 50 59 am
Then it will draw your graph in a nicer, left-to-right format:
screen shot 2017-01-27 at 11 52 35 am

Now regarding your issue, that inverting edge is actually drawn, it's just quite hard to see with this layout. I can just barely see it in your screenshot above. If I zoom in and manually separate the segments a bit, it's clearer:
screen shot 2017-01-27 at 11 54 34 am

Increasing the edge length could make it more obvious. I changed it from 5 (the default) to 25 in the preferences:
screen shot 2017-01-27 at 11 56 23 am
And now I get this layout:
screen shot 2017-01-27 at 11 57 11 am

And if you want to see it very explicitly, you can turn on double mode (in the main UI, not preferences):
screen shot 2017-01-27 at 11 58 52 am
This makes Bandage draw both directions of each segment. The graph is now more cluttered but less open to misinterpretation:
screen shot 2017-01-27 at 12 00 17 pm

Does that help? I'm going to close this issue, but if I missed something, let me know and I'll reopen it.

Ryan

from bandage.

ekg avatar ekg commented on September 13, 2024

The ordering of the visualization isn't the issue. It's just the fact that the inversion is extremely hard to perceive. I thought that it might have been represented in that edge but couldn't tell.

I think you should set the default edge length to 25 or add some other visual identification to inversions. This is a really critical problem. Inversions matter but the current default obscures them for users.

from bandage.

ekg avatar ekg commented on September 13, 2024

We are still having problems with this. Take this example graph:

funny.gfa.zip

It looks very simple in bandage. There are apparently several simple bubbles, which is what we're interested in:

test bandage

But when we dig into it we find that there isn't a single "simple" bubble where strand is maintained through the links of all the nodes in the bubble. They all include multiple inversions.

vg view --gfa-in --vg funny.gfa | vg mod -K - | vg view -d - | sed s/arrowhead=none,// | dot -Tpng -o f.vg.nolabel.png

f vg nolabel

This matches the GFA, as far as I can tell. So I don't think there is a problem with vg's rendering.

I'm not running Bandage--- it's a collaborator who is convinced that vg is doing something wrong because it doesn't transform the graph as we'd expect based on the way that Bandage renders it.

I'd like to convince them that it's important to use the settings you've described here to understand the structure of the graph more clearly.

I think it'd be a much, much stronger message if you would set these as default. It will save all of us a lot of explaining and diagnosing in the future.

It's really important to me that this is addressed. If the defaults aren't sane and respectful of the underlying data I won't recommend this tool to other users.

from bandage.

rrwick avatar rrwick commented on September 13, 2024

Okay, I'm getting a better idea of the problem here. If I understand correctly, you define an 'inversion' as a case where the positive strand of one segment connects to the negative strand of another. Is that right? Like this link your funny.gfa file:

L	88073	+	63608	-	150M

The confusion comes from the fact that some in graphs (like the SPAdes assembly graphs I'm most used to), the positive/negative distinction is arbitrary. I.e. a SPAdes assembly graph is full of 'inversions' that aren't meaningful at all. That's why in normal 'single' mode, Bandage doesn't draw arrowheads on nodes - they may not have any meaning.

But in your vg graphs, this distinction seems to matter very much. I thought of another Bandage feature which might help (again, it was a recent addition, so you'll need a current Bandage version): arrowheads in single mode (in the preferences window):
screen shot 2017-01-30 at 1 42 23 pm

I also gave the nodes some outline to make the arrowheads even more obvious:
screen shot 2017-01-30 at 1 45 16 pm

This makes your funny.gfa graph look like this (zoomed in to a 'bubble'):
screen shot 2017-01-30 at 1 46 33 pm

Now it's clear that the bubble has an inversion, while avoiding the complexity of double mode.

A possible future feature that might help would be an option to draw inverting edges in a different colour. I'll look into to adding that one. But even with these options (both currently available and future), I'd be reluctant to turn them on by default. In a SPAdes assembly graph, that is a simple bubble and highlighting an 'inversion' with colours/arrows would be confusing.

I guess the real issue is that different input graphs demand different Bandage settings. Is there a way a GFA file could be identified as coming from vg? I could add some logic like 'if this is a vg graph, turn this on, this off, etc.'

from bandage.

ekg avatar ekg commented on September 13, 2024

from bandage.

rrwick avatar rrwick commented on September 13, 2024

I haven't used FermiKit before, but is it possible that like SPAdes, it doesn't use the segment sign in any significant way? Using the same example as in my previous screenshot, perhaps this is a simple bubble:
screen shot 2017-01-31 at 1 20 10 pm

I.e. if FermiKit isn't indicating anything with the sign of the segment, then it wouldn't matter that we're looking at the negative strand of 1504. It's just a sequence which splits into two options and then merges back together.

To illustrate, I took your funny.gfa graph and strategically 'flipped' some of the segments (changed them to their reverse complement sequence and made the corresponding sign changes to the links).
funny_flipped.gfa.zip

Now all edges are + to + and the whole graph flows in one direction:
screen shot 2017-01-31 at 1 16 31 pm

Assuming there is no significance to the +/- sign, then I haven't changed the graph in any real way - I've just normalised the strands.

from bandage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.