comparison read2mut.py @ 57:706bf8b59eae draft

planemo upload for repository https://github.com/Single-Molecule-Genetics/VariantAnalyzerGalaxy/tree/master/tools/variant_analyzer commit ee4a8e6cf290e6c8a4d55f9cd2839d60ab3b11c8
author mheinzl
date Fri, 12 Mar 2021 14:29:17 +0000
parents 371c09d4050b
children 04741369fc07
comparison
equal deleted inserted replaced
56:371c09d4050b 57:706bf8b59eae
315 counter_tier7 = 0 315 counter_tier7 = 0
316 316
317 row = 1 317 row = 1
318 tier_dict = {} 318 tier_dict = {}
319 chimera_dict = {} 319 chimera_dict = {}
320 change_tier_after_print = {} 320 #change_tier_after_print = {}
321 for key1, value1 in sorted(mut_dict.items()): 321 for key1, value1 in sorted(mut_dict.items()):
322 counts_mut = 0 322 counts_mut = 0
323 chimeric_tag_list = [] 323 chimeric_tag_list = []
324 chimeric_tag = {} 324 chimeric_tag = {}
325 if key1 in pure_tags_dict_short.keys(): 325 if key1 in pure_tags_dict_short.keys():
326 change_tier_after_print = []
327
326 i = np.where(np.array(['#'.join(str(i) for i in z) 328 i = np.where(np.array(['#'.join(str(i) for i in z)
327 for z in zip(mut_array[:, 0], mut_array[:, 1], mut_array[:, 2], mut_array[:, 3])]) == key1)[0][0] 329 for z in zip(mut_array[:, 0], mut_array[:, 1], mut_array[:, 2], mut_array[:, 3])]) == key1)[0][0]
328 ref = mut_array[i, 2] 330 ref = mut_array[i, 2]
329 alt = mut_array[i, 3] 331 alt = mut_array[i, 3]
330 dcs_median = cvrg_dict[key1][2] 332 dcs_median = cvrg_dict[key1][2]
1058 # {'type': 'formula', 1060 # {'type': 'formula',
1059 # 'criteria': '=$B${}>="3"'.format(row + 1), 1061 # 'criteria': '=$B${}>="3"'.format(row + 1),
1060 # 'format': format2, 1062 # 'format': format2,
1061 # 'multi_range': 'L{}:M{} T{}:U{} B{}'.format(row + 1, row + 2, row + 1, row + 2, row + 1, row + 2)}) 1063 # 'multi_range': 'L{}:M{} T{}:U{} B{}'.format(row + 1, row + 2, row + 1, row + 2, row + 1, row + 2)})
1062 #if trimmed: 1064 #if trimmed:
1063 if key1 not in list(change_tier_after_print.keys()): 1065 #if key1 not in list(change_tier_after_print.keys()):
1064 change_tier_after_print[key1] = [((row, line, line2))] 1066 # change_tier_after_print[key1] = [((row, line, line2))]
1065 else: 1067 #else:
1066 change_tier_after_print[key1].append(((row, line, line2))) 1068 change_tier_after_print.append((row, line, line2))
1067 1069
1068 row += 3 1070 row += 3
1069 1071
1070 if chimera_correction: 1072 if chimera_correction:
1071 chimeric_dcs_high_tiers = 0 1073 chimeric_dcs_high_tiers = 0
1090 if tier_dict[key1]["tier 4"] > 0 and sum_highTiers > 0: 1092 if tier_dict[key1]["tier 4"] > 0 and sum_highTiers > 0:
1091 tier_dict[key1]["tier 2.5"] = tier_dict[key1]["tier 4"] 1093 tier_dict[key1]["tier 2.5"] = tier_dict[key1]["tier 4"]
1092 tier_dict[key1]["tier 4"] = 0 1094 tier_dict[key1]["tier 4"] = 0
1093 correct_tier = True 1095 correct_tier = True
1094 1096
1095 lines = change_tier_after_print[key1] 1097 #lines = change_tier_after_print[key1]
1096 for sample in lines: 1098 for sample in change_tier_after_print:
1097 row = sample[0] 1099 row_number = sample[0]
1098 line1 = sample[1] 1100 line1 = sample[1]
1099 line2 = sample[2] 1101 line2 = sample[2]
1100 1102
1101 if correct_tier: 1103 if correct_tier:
1102 line1 = list(line1) 1104 line1 = list(line1)
1103 line1[1] = "2.5" 1105 line1[1] = "2.5"
1104 line1 = tuple(line1) 1106 line1 = tuple(line1)
1105 ws1.write_row(row, 0, line1) 1107 ws1.write_row(row_number, 0, line1)
1106 csv_writer.writerow(line1) 1108 csv_writer.writerow(line1)
1107 ws1.write_row(row + 1, 0, line2) 1109 ws1.write_row(row_number + 1, 0, line2)
1108 csv_writer.writerow(line2) 1110 csv_writer.writerow(line2)
1109 1111
1110 ws1.conditional_format('L{}:M{}'.format(row + 1, row + 2), 1112 ws1.conditional_format('L{}:M{}'.format(row + 1, row + 2),
1111 {'type': 'formula', 1113 {'type': 'formula',
1112 'criteria': '=OR($B${}="1.1", $B${}="1.2")'.format(row + 1, row + 1), 1114 'criteria': '=OR($B${}="1.1", $B${}="1.2")'.format(row + 1, row + 1),