marbl / MetagenomeScope

Visualization tool for (meta)genome assembly graphs
https://marbl.github.io/MetagenomeScope/
GNU General Public License v3.0
24 stars 8 forks source link

Configurable segment / "node" shapes #211

Open fedarko opened 2 years ago

fedarko commented 2 years ago

Thought I'd opened another issue for this here in the past, but seems like I hadn't.

The GFA files output from certain assemblers (flye, spades IIRC, and probably more) are kind of inaccurate -- in the sense that they define "segments" and "links", but these segments really correspond to edges in a de Bruijn / repeat graph (rather than nodes) and the links really correspond to nodes (rather than edges). In spite of this, most tools (e.g. Bandage, MetagenomeScope) will visualize segments as nodes and links as edges.

This is fine -- the structures are essentially mostly equivalent, and it's possible to convert between them. (Also, AGB visualizes these graphs as you would expect.) However, for convenience's sake, it might be nice to add a simple option to just draw segments as arrows rather than as these uh pentagon-ish contig shapes -- this is doable in Cytoscape.js by adjusting the shape-polygon-points parameter. This would look something like the following hastily-drawn figure (except, you know, less gross).

arrow-schematic

This could range from just a simple toggle (pentagons vs. arrows) or actually allowing the user to specify custom strings for Cytoscape.js' shape-polygon-points parameter. Probably the former is sufficient for now.

fedarko commented 2 years ago

Modifying the polygon points to do this is actually pretty feasible. See before (current pentagons) and after (arrows) below.

For reference, the polygon points:

// left <--
                                "1 0.4 -0.2 0.4 -0.2 0.8 -1 0 -0.2 -0.8 -0.2 -0.4 1 -0.4",
// right -->
                                "-1 0.4 0.2 0.4 0.2 0.8 1 0 0.2 -0.8 0.2 -0.4 -1 -0.4",

mgsc-2022-03-31T00_03_12

mgsc-2022-03-31T00_03_19