From 24ca2fe2cac439f226d7f4de7af925756ba19423 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 19 Aug 2024 15:40:58 -0400 Subject: [PATCH] making phasing determenistic --- src/scripts/cluster.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/scripts/cluster.py b/src/scripts/cluster.py index 5cb75b58..e924818b 100755 --- a/src/scripts/cluster.py +++ b/src/scripts/cluster.py @@ -432,7 +432,7 @@ def run_clustering (graph_gfa, mashmap_sim, hic_byread, output_dir, no_rdna, une random.seed(seed) p1 = [] p2 = [] - for n in C.nodes(): + for n in sorted(C.nodes()): if n in matchGraph and len(matchGraph.edges(n)) > 0: #TODO: replace with something reasonable! multiple nodes will not work here. Transform each homology component into one node before?.. Anyway, it still should be fixed later with K-L iterations. for ec in matchGraph.edges(n): @@ -534,13 +534,13 @@ def run_clustering (graph_gfa, mashmap_sim, hic_byread, output_dir, no_rdna, une best_part[1].update(add_part[1]) right = False for ind in range (0, 2): - for contig in best_part[ind]: + for contig in sorted(best_part[ind]): if contig in current_component: if ind == 1: tsv_file.write(f'{contig}\t0\t100000\t0:100000\t#8888FF\n') else: tsv_file.write(f'{contig}\t100000\t0\t100000:0\t#FF8888\n') - for contig in only_weights.keys(): + for contig in sorted(only_weights.keys()): tsv_file.write(f'{contig}\t{only_weights[contig][0]}\t{only_weights[contig][1]}\t{only_weights[contig][0]}:{only_weights[contig][1]}\t#88FF88\n')