Skip to content

Commit

Permalink
throw error and abort before writing invalid reverse-strand rGFA step
Browse files Browse the repository at this point in the history
  • Loading branch information
glennhickey committed Mar 1, 2021
1 parent 292717e commit 719aa5d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/gfa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <gfakluge.hpp>
#include "utility.hpp"
#include "path.hpp"
#include <sstream>

namespace vg {

Expand Down Expand Up @@ -30,6 +31,12 @@ void graph_to_gfa(const PathHandleGraph* graph, ostream& out, const set<string>&
graph->for_each_step_in_path(path_handle, [&](step_handle_t step_handle) {
handle_t handle = graph->get_handle_of_step(step_handle);
nid_t node_id = graph->get_id(handle);
if (graph->get_is_reverse(handle)) {
stringstream ss;
ss << "error [gfa]: unable to write rGFA tags for path " << path_name << " because node "
<< node_id << " is traversed on its reverse strand. rGFA only supports the forward strand." << endl;
throw runtime_error(ss.str());
}
if (node_offsets.count(node_id)) {
cerr << "warning [gfa]: multiple selected rgfa paths found on node " << node_id << ": keeping tags for "
<< graph->get_path_name(node_offsets[node_id].first) << " and ignoring those for " << path_name << endl;
Expand Down

1 comment on commit 719aa5d

@adamnovak
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vg CI tests complete for branch handle-stuff. View the full report here.

16 tests passed, 0 tests failed and 0 tests skipped in 11797 seconds

Please sign in to comment.