diff --git a/.gitignore b/.gitignore index 5570830b..3f92b884 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,7 @@ docs/sphinx_build docs/sphinx_build_man docs/_build Testing/ -.idea/ \ No newline at end of file +.idea/ +.vscode/ +.cmake/ +cmake-build-debug/ \ No newline at end of file diff --git a/src/algorithms/draw.cpp b/src/algorithms/draw.cpp index 31ce5454..e95c2d0b 100644 --- a/src/algorithms/draw.cpp +++ b/src/algorithms/draw.cpp @@ -166,7 +166,7 @@ Coordinates adjustNodeLength(double x1, double y1, double x2, double y2, double // Return the new coordinates return Coordinates{new_x1, new_y1, new_x2, new_y2}; } -Coordinates adjustNodeEndpoints(const handle_t& handle, const std::vector& X, const std::vector& Y, double scale, double x_off, double y_off, double sparsification_factor) { +Coordinates adjustNodeEndpoints(const handle_t& handle, const std::vector& X, const std::vector& Y, double scale, double x_off, double y_off, double sparsification_factor, bool lengthen_left_nodes) { // Original coordinates uint64_t a = 2 * number_bool_packing::unpack_number(handle); double x1 = (X[a] * scale) - x_off; @@ -178,7 +178,7 @@ Coordinates adjustNodeEndpoints(const handle_t& handle, const std::vector& node_id_to_color, ska::flat_hash_map>& node_id_to_label_map, - const float& sparsification_factor) { + const float& sparsification_factor, + const bool& lengthen_left_nodes) { std::vector> weak_components; coord_range_2d_t rendered_range; @@ -251,7 +252,7 @@ void draw_svg(std::ostream &out, continue; // Skip this node to output a lighter SVG (do not nodes with labels, if any) } - Coordinates newEndpoints = adjustNodeEndpoints(handle, X, Y, scale, x_off, y_off, sparsification_factor); + Coordinates newEndpoints = adjustNodeEndpoints(handle, X, Y, scale, x_off, y_off, sparsification_factor, lengthen_left_nodes); if (color == COLOR_BLACK || color == COLOR_LIGHTGRAY) { out << "& node_id_to_color, ska::flat_hash_map>& node_id_to_label_map, - const float& sparsification_factor); + const float& sparsification_factor, + const bool& lengthen_left_nodes); std::vector rasterize(const std::vector &X, const std::vector &Y, diff --git a/src/subcommand/draw_main.cpp b/src/subcommand/draw_main.cpp index 07f2c379..86df9ccc 100644 --- a/src/subcommand/draw_main.cpp +++ b/src/subcommand/draw_main.cpp @@ -51,7 +51,8 @@ int main_draw(int argc, char **argv) { "Colors are derived from the 4th column, if present, else from the path name." "If the 4th column value is in the format 'string#RRGGBB', the RRGGBB color (in hex notation) will be used.", {'b', "bed-file"}); - args::ValueFlag node_sparsification(parser, "N", "Remove this fraction of nodes from the SVG output (to output smaller files) (default: 0.0, keep all nodes).", {'f', "svg-sparse-factor"}); + args::ValueFlag node_sparsification(visualizations_opts, "N", "Remove this fraction of nodes from the SVG output (to output smaller files) (default: 0.0, keep all nodes).", {'f', "svg-sparse-factor"}); + args::Flag lengthen_left_nodes(visualizations_opts, "lengthen", "When node sparsitication is active, lengthen the remaining nodes proportionally with the sparsification factor", {'l', "svg-lengthen-nodes"}); args::Group threading(parser, "[ Threading ]"); args::ValueFlag nthreads(threading, "N", "Number of threads to use for parallel operations.", {'t', "threads"}); args::Group processing_info_opts(parser, "[ Processing Information ]"); @@ -111,7 +112,7 @@ int main_draw(int argc, char **argv) { if (infile == "-") { graph.deserialize(std::cin); } else { - utils::handle_gfa_odgi_input(infile, "draw", args::get(progress), num_threads, graph); + utils::handle_gfa_odgi_input(infile, "draw", lengthen_left_nodes, num_threads, graph); } } } @@ -231,7 +232,7 @@ int main_draw(int argc, char **argv) { // todo could be done with callbacks std::vector X = layout.get_X(); std::vector Y = layout.get_Y(); - algorithms::draw_svg(f, X, Y, graph, svg_scale, border_bp, _png_line_width, node_id_to_color, node_id_to_label_map, sparse_nodes); + algorithms::draw_svg(f, X, Y, graph, svg_scale, border_bp, _png_line_width, node_id_to_color, node_id_to_label_map, sparse_nodes, args::get(lengthen_left_nodes)); f.close(); }