@@ -19,16 +19,16 @@ def chunks(l, n):
19
19
for i in range (0 , len (l ), n ):
20
20
yield l [i :i + n ]
21
21
22
- def write_best_prob (name_gl , res , probs , numOfResult , fout ):
22
+ def write_best_prob (name_gl , res , probs , numOfResult , fout , sign = "," ):
23
23
sumProbsDict = defaultdict (list )
24
24
#loop over the result and sum the prob by populations/haplotype
25
25
for k in range (len (res )):
26
- key = res [k ][0 ] + "," + res [k ][1 ]
26
+ key = res [k ][0 ] + sign + res [k ][1 ]
27
27
if key in sumProbsDict :
28
28
sumProb = probs [k ] + sumProbsDict [key ]
29
29
sumProbsDict [key ] = sumProb
30
30
else :
31
- key2 = res [k ][1 ] + "," + res [k ][0 ]
31
+ key2 = res [k ][1 ] + sign + res [k ][0 ]
32
32
if key2 in sumProbsDict :
33
33
sumProb = probs [k ] + sumProbsDict [key2 ]
34
34
sumProbsDict [key2 ] = sumProb
@@ -1727,7 +1727,7 @@ def impute_file(self, config, planb=None, em_mr = False, em = False):##em
1727
1727
write_best_hap_race_pairs (subject_id , haps , pops , probs , number_of_results , fout_hap_haplo )
1728
1728
write_best_prob (subject_id , pops , probs , 1 , fout_pop_haplo )
1729
1729
else :
1730
- write_best_prob (subject_id , haps , probs , number_of_results , fout_hap_haplo )
1730
+ write_best_prob (subject_id , haps , probs , number_of_results , fout_hap_haplo , "+" )
1731
1731
write_best_prob (subject_id , pops , probs , number_of_pop_results , fout_pop_haplo )
1732
1732
if MUUG_output :
1733
1733
haps = res_muugs ['Haps' ]
0 commit comments