Closed ASLeonard closed 2 months ago
@ASLeonard, thank you for breaking ODGI xD I've put a few polite checks in #591. Could you try to break it again?
The changes handle all the bad files I had. And they print a very useful message for the error as well!
This is likely an obscure corner case that is hard to protect against, but may be useful. I'm not sure if it is the responsibility of
odgi
to gracefully tell people their graphs are malformed rather than crashing, but there is at least a partial issue here.Running
odgi validate
on a gfa where the path includes a non-existant node causes a segfault.Arguably, the description of the subcommand should tell the user the paths are not consistent with the graph (since no path can contain node 5 since node 5 doesn't exist). This currently only checks for consistency with L-lines assuming L-lines are already consistent with S-lines.
Interestingly, a gfa with a link line containing a non-existant node raises a "Floating point exception"
This can be guarded against with some checks in src/gfa_to_handle.cpp, namely for edges here
https://github.com/pangenome/odgi/blob/2151dd8d73d382e8136509a487e0628a0ca0b62f/src/gfa_to_handle.cpp#L89-L91
and presumably for paths here
https://github.com/pangenome/odgi/blob/2151dd8d73d382e8136509a487e0628a0ca0b62f/src/gfa_to_handle.cpp#L127-L129
Unsurprisingly since the issue originates in the gfa loading, almost all subcommands segfault if the path contains a non-existant node.
Best, Alex