@@ -454,6 +454,16 @@ def remove_transitive_edges(graph):
454
454
ret [parent ] = lst
455
455
return ret
456
456
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
+
457
467
def get_transitive_children (recur , lst , graph , current ):
458
468
for child in graph .get (current , []):
459
469
if child not in recur :
@@ -552,7 +562,8 @@ def record_alive(contig: Contig):
552
562
553
563
def record_bad_contig (contig : GenotypedContig , lst : List [str ]):
554
564
complete_contig_map [contig .name ] = contig
555
- lst .append (contig .name )
565
+ if contig .name not in lst :
566
+ lst .append (contig .name )
556
567
557
568
def record_lstrip (result : AlignedContig , original : AlignedContig ):
558
569
lstrip_map [result .name ] = original .name
@@ -642,7 +653,8 @@ def record_rstrip(result: AlignedContig, original: AlignedContig):
642
653
x : NoReturn = event
643
654
raise RuntimeError (f"Unrecognized action or event: { event } " )
644
655
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 )
646
658
647
659
# Close alive set by parents
648
660
def extend_alive (contig_name ):
0 commit comments