@@ -839,12 +839,15 @@ def get_contig_coordinates(contig):
839
839
a_r_ei = f_r_ei
840
840
return (a_r_st , a_r_ei , f_r_st , f_r_ei )
841
841
842
- def get_tracks (group_ref , contig_name ):
842
+ def get_tracks (repeatset , group_ref , contig_name ):
843
843
parts = final_parent_mapping [contig_name ]
844
844
for part_name in parts :
845
845
part = contig_map [part_name ]
846
846
847
- if part_name in bad_contigs :
847
+ if part .name in repeatset :
848
+ continue
849
+
850
+ if part .name in bad_contigs :
848
851
continue
849
852
850
853
if not isinstance (part , AlignedContig ):
@@ -853,16 +856,20 @@ def get_tracks(group_ref, contig_name):
853
856
if part .group_ref != group_ref :
854
857
continue
855
858
859
+ repeatset .add (part .name )
856
860
indexes = name_mappings [part .name ]
857
861
(a_r_st , a_r_ei , f_r_st , f_r_ei ) = get_contig_coordinates (part )
858
862
yield Track (f_r_st , f_r_ei , label = f"{ indexes } " )
859
863
860
- def get_arrows (group_ref , contig_name , labels ):
864
+ def get_arrows (repeatset , group_ref , contig_name , labels ):
861
865
parts = final_parent_mapping [contig_name ]
862
866
for part_name in parts :
863
867
part = contig_map [part_name ]
864
868
865
- if part_name in bad_contigs :
869
+ if part .name in repeatset :
870
+ continue
871
+
872
+ if part .name in bad_contigs :
866
873
continue
867
874
868
875
if not isinstance (part , AlignedContig ):
@@ -871,6 +878,7 @@ def get_arrows(group_ref, contig_name, labels):
871
878
if part .group_ref != group_ref :
872
879
continue
873
880
881
+ repeatset .add (part .name )
874
882
indexes = name_mappings [part .name ] if labels else None
875
883
height = 20 if labels else 1
876
884
elevation = 1 if labels else - 20
@@ -881,8 +889,9 @@ def get_arrows(group_ref, contig_name, labels):
881
889
label = indexes )
882
890
883
891
def get_all_arrows (group_ref , labels ):
892
+ repeatset = set ()
884
893
for parent_name in sorted_roots :
885
- yield from get_arrows (group_ref , parent_name , labels )
894
+ yield from get_arrows (repeatset , group_ref , parent_name , labels )
886
895
887
896
################
888
897
# Drawing part #
@@ -955,11 +964,13 @@ def get_all_arrows(group_ref, labels):
955
964
# Contigs #
956
965
###########
957
966
967
+ repeatset1 = set ()
968
+ repeatset2 = set ()
958
969
for parent_name in sorted_roots :
959
- arrows = list (get_arrows (group_ref , parent_name , labels = False ))
970
+ arrows = list (get_arrows (repeatset1 , group_ref , parent_name , labels = False ))
960
971
if arrows :
961
972
figure .add (ArrowGroup (arrows ))
962
- parts = list (get_tracks (group_ref , parent_name ))
973
+ parts = list (get_tracks (repeatset2 , group_ref , parent_name ))
963
974
if parts :
964
975
figure .add (Multitrack (parts ))
965
976
0 commit comments