@@ -454,6 +454,16 @@ def remove_transitive_edges(graph):
454454 ret [parent ] = lst
455455 return ret
456456
457+ def remove_duplicate_edges (graph ):
458+ ret = {}
459+ for parent , children in graph .items ():
460+ lst = []
461+ for child in children :
462+ if child not in lst :
463+ lst .append (child )
464+ ret [parent ] = lst
465+ return ret
466+
457467 def get_transitive_children (recur , lst , graph , current ):
458468 for child in graph .get (current , []):
459469 if child not in recur :
@@ -552,7 +562,8 @@ def record_alive(contig: Contig):
552562
553563 def record_bad_contig (contig : GenotypedContig , lst : List [str ]):
554564 complete_contig_map [contig .name ] = contig
555- lst .append (contig .name )
565+ if contig .name not in lst :
566+ lst .append (contig .name )
556567
557568 def record_lstrip (result : AlignedContig , original : AlignedContig ):
558569 lstrip_map [result .name ] = original .name
@@ -642,7 +653,8 @@ def record_rstrip(result: AlignedContig, original: AlignedContig):
642653 x : NoReturn = event
643654 raise RuntimeError (f"Unrecognized action or event: { event } " )
644655
645- nodup_parent_graph = remove_transitive_edges (complete_parent_graph )
656+ notransitive_parent_graph = remove_transitive_edges (complete_parent_graph )
657+ nodup_parent_graph = remove_duplicate_edges (notransitive_parent_graph )
646658
647659 # Close alive set by parents
648660 def extend_alive (contig_name ):
0 commit comments