pangenome / odgi

Optimized Dynamic Genome/Graph Implementation: understanding pangenome graphs
https://doi.org/10.1093/bioinformatics/btac308
MIT License
196 stars 40 forks source link

`odgi unchop`: avoid merging the same node multiple times #465

Closed AndreaGuarracino closed 1 year ago

AndreaGuarracino commented 1 year ago

This avoids merging the same node multiple times, thus avoiding generating invalid unchopped graphs.

bug.gfa

H   VN:Z:1.0
S   1   C
S   2   T
L   2   -   1   +   0M
S   3   G
L   3   +   2   -   0M
P   A   3+,2-,1+    *
odgi unchop -i bug.gfa -o - | odgi view -i - -g

[odgi::algorithms::unchop] failure in unchop
>expected_A
GAC
>got_A
GACC

H   VN:Z:1.0
S   1   CC
S   2   T
L   2   -   1   +   0M
S   3   G
L   3   +   2   -   0M
P   A   3+,2-,1+    *

In this example, the new node 1 (CC) is generated by mistakenly merging the old node 1 (C) two times.