comparison read2mut.py @ 80:8336a4f2b647 draft

planemo upload for repository https://github.com/Single-Molecule-Genetics/VariantAnalyzerGalaxy/tree/master/tools/variant_analyzer commit ee4a8e6cf290e6c8a4d55f9cd2839d60ab3b11c8-dirty
author mheinzl
date Tue, 26 Jul 2022 10:19:28 +0000
parents d7aea14291e8
children 612c110305db
comparison
equal deleted inserted replaced
79:d7aea14291e8 80:8336a4f2b647
1365 sum_highTiers = sum([tier_dict[key1][ij] for ij in list(sorted(tier_dict[key1].keys()))[:6]]) 1365 sum_highTiers = sum([tier_dict[key1][ij] for ij in list(sorted(tier_dict[key1].keys()))[:6]])
1366 sum_highTiers_ref = sum([tier_dict_ref[key1][ij] for ij in list(sorted(tier_dict_ref[key1].keys()))[:6]]) 1366 sum_highTiers_ref = sum([tier_dict_ref[key1][ij] for ij in list(sorted(tier_dict_ref[key1].keys()))[:6]])
1367 correct_tier = False 1367 correct_tier = False
1368 correct_tier_ref = False 1368 correct_tier_ref = False
1369 if tier_dict[key1]["tier 4"] > 0 and sum_highTiers > 0: 1369 if tier_dict[key1]["tier 4"] > 0 and sum_highTiers > 0:
1370 tier_dict[key1]["tier 2.5"] = tier_dict[key1]["tier 4"] 1370 # tier_dict[key1]["tier 2.5"] = tier_dict[key1]["tier 4"]
1371 tier_dict[key1]["tier 4"] = 0 1371 # tier_dict[key1]["tier 4"] = 0
1372 correct_tier = True 1372 correct_tier = True
1373 1373 elif tier_dict_ref[key1]["tier 4"] > 0 and sum_highTiers_ref > 0:
1374 if tier_dict_ref[key1]["tier 4"] > 0 and sum_highTiers_ref > 0: 1374 # tier_dict_ref[key1]["tier 2.5"] = tier_dict_ref[key1]["tier 4"]
1375 tier_dict_ref[key1]["tier 2.5"] = tier_dict_ref[key1]["tier 4"] 1375 # tier_dict_ref[key1]["tier 4"] = 0
1376 tier_dict_ref[key1]["tier 4"] = 0
1377 correct_tier_ref = True 1376 correct_tier_ref = True
1378 # print(key1, "change tiers from tier 4 to tier 2.5 for {} DCS ...".format(len(change_tier_after_print))) 1377 # print(key1, "change tiers from tier 4 to tier 2.5 for {} DCS ...".format(len(change_tier_after_print)))
1379 if len(change_tier_after_print) > 0: 1378 if len(change_tier_after_print) > 0:
1380 for sample in change_tier_after_print: 1379 for sample in change_tier_after_print:
1381 # row_number = sample[0] 1380 # row_number = sample[0]
1387 line1 = list(line1) 1386 line1 = list(line1)
1388 line1[1] = "2.5" 1387 line1[1] = "2.5"
1389 line1 = tuple(line1) 1388 line1 = tuple(line1)
1390 counter_tier25 += 1 1389 counter_tier25 += 1
1391 counter_tier4 -= 1 1390 counter_tier4 -= 1
1392 if line1[2] == "ref" and correct_tier_ref and (current_tier == "4") and actual_high_tier: 1391 tier_dict[key1]["tier 2.5"] += 1
1392 tier_dict[key1]["tier 4"] -= 1
1393 elif line1[2] == "ref" and correct_tier_ref and (current_tier == "4") and actual_high_tier:
1393 line1 = list(line1) 1394 line1 = list(line1)
1394 line1[1] = "2.5" 1395 line1[1] = "2.5"
1395 line1 = tuple(line1) 1396 line1 = tuple(line1)
1396 counter_tier25 += 1 1397 counter_tier25 += 1
1397 counter_tier4 -= 1 1398 counter_tier4 -= 1
1399 tier_dict_ref[key1]["tier 2.5"] += 1
1400 tier_dict_ref[key1]["tier 4"] -= 1
1398 ws1.write_row(row, 0, line1) 1401 ws1.write_row(row, 0, line1)
1399 csv_writer.writerow(line1) 1402 csv_writer.writerow(line1)
1400 ws1.write_row(row + 1, 0, line2) 1403 ws1.write_row(row + 1, 0, line2)
1401 csv_writer.writerow(line2) 1404 csv_writer.writerow(line2)
1402 if line1[2] == "alt": 1405 if line1[2] == "alt":