asl/BandageNG

Please add an option to write the layout to a file

Closed this issue · 10 comments

Hi @asl,
thanks for maintaining and polishing BandageNG!

Currently, BandageNG can only draw a graph to a PNG:

Version: 2022.10-dev

Usage:    BandageNG <command> [options]
          
Commands: <blank>      Launch the Bandage-NG GUI
          load         Launch the Bandage-NG GUI and load a graph file
          info         Display information about a graph
          image        Generate an image file of a graph
          querypaths   Output graph paths for BLAST queries
          reduce       Save a subgraph of a larger graph

However, I would like to obtain the layout directly.
For example, each line in the file could be:

node_id	x_coordinate	y_coordinate

I hope that should be easily doable.
Thanks!
Best,
Simon

asl commented

This is essentially #50

For now, please consider using GUI for this

I see.

However, for performance tests, that's not feasible. And I want to apply several ways to measure the stress in the resulting graph.

asl commented

Well, I'll try to see what could be done here. However, cmdline interface is essentially a parallel duplicate code and it is very incomplete as of now.

asl commented

The next version of Bandage-NG will include a dedicated layout subcommand to do this

Awesome!

asl commented

@subwaystation In #127 we're having:

# BandageNG layout --help
Layout the graph
Usage: ./BandageNG.app/Contents/MacOS/BandageNG layout [OPTIONS] <graph> <layout>

Positionals:
  <graph> TEXT:FILE REQUIRED  A graph file of any type supported by Bandage
  <layout> TEXT REQUIRED      The layout file to be created (must end with .tsv or .layout)

Options:
  -h,--help                   Print this help message and exit
  --helpall

This is awesome, thanks @asl !

asl commented

Note that you can take the latest snapshot from Releases page and check it out

Building from source worked, now I got it :)

Where within the node are the coordinates? At the start? In the middle? At the end? Thanks!

asl commented

@subwaystation There two different outputs:

  • .layout file is a JSON containing coordinates for all segments of every node.
  • .tsv is a simplified one. We report the coordinate of the first segment of a node.