comparison read2mut.py @ 27:5992e30ae50e draft

planemo upload for repository https://github.com/Single-Molecule-Genetics/VariantAnalyzerGalaxy/tree/master/tools/variant_analyzer commit ee4a8e6cf290e6c8a4d55f9cd2839d60ab3b11c8
author mheinzl
date Mon, 22 Feb 2021 16:56:05 +0000
parents 5cb0bdd578cf
children afda74e874ac
comparison
equal deleted inserted replaced
26:5cb0bdd578cf 27:5992e30ae50e
14 ======= ========== ================= ================================ 14 ======= ========== ================= ================================
15 15
16 16
17 USAGE: python read2mut.py --mutFile DCS_Mutations.tabular --bamFile Interesting_Reads.trim.bam 17 USAGE: python read2mut.py --mutFile DCS_Mutations.tabular --bamFile Interesting_Reads.trim.bam
18 --inputJson tag_count_dict.json --sscsJson SSCS_counts.json 18 --inputJson tag_count_dict.json --sscsJson SSCS_counts.json
19 --outputFile mutant_reads_summary_short_trim.xlsx --thresh 10 --phred 20 --trim5 10 --trim3 10 --chimera_correction 19 --outputFile mutant_reads_summary_short_trim.xlsx --thresh 10 --phred 20 --trim 10 --chimera_correction
20 20
21 """ 21 """
22 22
23 from __future__ import division 23 from __future__ import division
24 24
25 import argparse 25 import argparse
26 import csv
27 import json 26 import json
28 import operator 27 import operator
29 import os 28 import os
30 import re 29 import re
31 import sys 30 import sys
32
33 31
34 import numpy as np 32 import numpy as np
35 import pysam 33 import pysam
36 import xlsxwriter 34 import xlsxwriter
37 from cyvcf2 import VCF 35 from cyvcf2 import VCF
47 help='JSON file with data collected by mut2read.py.') 45 help='JSON file with data collected by mut2read.py.')
48 parser.add_argument('--sscsJson', 46 parser.add_argument('--sscsJson',
49 help='JSON file with SSCS counts collected by mut2sscs.py.') 47 help='JSON file with SSCS counts collected by mut2sscs.py.')
50 parser.add_argument('--outputFile', 48 parser.add_argument('--outputFile',
51 help='Output xlsx file with summary of mutations.') 49 help='Output xlsx file with summary of mutations.')
52 parser.add_argument('--outputFile_csv',
53 help='Output csv file with summary of mutations.')
54 parser.add_argument('--outputFile2', 50 parser.add_argument('--outputFile2',
55 help='Output xlsx file with allele frequencies of mutations.') 51 help='Output xlsx file with allele frequencies of mutations.')
56 parser.add_argument('--outputFile3', 52 parser.add_argument('--outputFile3',
57 help='Output xlsx file with examples of the tier classification.') 53 help='Output xlsx file with examples of the tier classification.')
58 parser.add_argument('--thresh', type=int, default=0, 54 parser.add_argument('--thresh', type=int, default=0,
59 help='Integer threshold for displaying mutations. Only mutations occuring less than thresh times are displayed. Default of 0 displays all.') 55 help='Integer threshold for displaying mutations. Only mutations occuring less than thresh times are displayed. Default of 0 displays all.')
60 parser.add_argument('--phred', type=int, default=20, 56 parser.add_argument('--phred', type=int, default=20,
61 help='Integer threshold for Phred score. Only reads higher than this threshold are considered. Default 20.') 57 help='Integer threshold for Phred score. Only reads higher than this threshold are considered. Default 20.')
62 parser.add_argument('--trim5', type=int, default=10, 58 parser.add_argument('--trim', type=int, default=10,
63 help='Integer threshold for assigning mutations at start of reads to lower tier. Default 10.') 59 help='Integer threshold for assigning mutations at start and end of reads to lower tier. Default 10.')
64 parser.add_argument('--trim3', type=int, default=10,
65 help='Integer threshold for assigning mutations at end of reads to lower tier. Default 10.')
66 parser.add_argument('--chimera_correction', action="store_true", 60 parser.add_argument('--chimera_correction', action="store_true",
67 help='Count chimeric variants and correct the variant frequencies') 61 help='Count chimeric variants and correct the variant frequencies')
68 return parser 62 return parser
69 63
70 64
82 json_file = args.inputJson 76 json_file = args.inputJson
83 sscs_json = args.sscsJson 77 sscs_json = args.sscsJson
84 outfile = args.outputFile 78 outfile = args.outputFile
85 outfile2 = args.outputFile2 79 outfile2 = args.outputFile2
86 outfile3 = args.outputFile3 80 outfile3 = args.outputFile3
87 outputFile_csv = args.outputFile_csv
88 thresh = args.thresh 81 thresh = args.thresh
89 phred_score = args.phred 82 phred_score = args.phred
90 trim5 = args.trim5 83 trim = args.trim
91 trim3 = args.trim3
92 chimera_correction = args.chimera_correction 84 chimera_correction = args.chimera_correction
93 85
94 if os.path.isfile(file1) is False: 86 if os.path.isfile(file1) is False:
95 sys.exit("Error: Could not find '{}'".format(file1)) 87 sys.exit("Error: Could not find '{}'".format(file1))
96 if os.path.isfile(file2) is False: 88 if os.path.isfile(file2) is False:
99 sys.exit("Error: Could not find '{}'".format(json_file)) 91 sys.exit("Error: Could not find '{}'".format(json_file))
100 if thresh < 0: 92 if thresh < 0:
101 sys.exit("Error: thresh is '{}', but only non-negative integers allowed".format(thresh)) 93 sys.exit("Error: thresh is '{}', but only non-negative integers allowed".format(thresh))
102 if phred_score < 0: 94 if phred_score < 0:
103 sys.exit("Error: phred is '{}', but only non-negative integers allowed".format(phred_score)) 95 sys.exit("Error: phred is '{}', but only non-negative integers allowed".format(phred_score))
104 if trim5 < 0: 96 if trim < 0:
105 sys.exit("Error: trim5 is '{}', but only non-negative integers allowed".format(trim5)) 97 sys.exit("Error: trim is '{}', but only non-negative integers allowed".format(thresh))
106 if trim3 < 0:
107 sys.exit("Error: trim3 is '{}', but only non-negative integers allowed".format(trim3))
108 98
109 # load dicts 99 # load dicts
110 with open(json_file, "r") as f: 100 with open(json_file, "r") as f:
111 (tag_dict, cvrg_dict) = json.load(f) 101 (tag_dict, cvrg_dict) = json.load(f)
112 102
235 if len(value) < thresh: 225 if len(value) < thresh:
236 pure_tags_dict_short[key] = value 226 pure_tags_dict_short[key] = value
237 else: 227 else:
238 pure_tags_dict_short = pure_tags_dict 228 pure_tags_dict_short = pure_tags_dict
239 229
240 #csv_data = open(outputFile_csv, "w")
241 #csv_writer = csv.writer(csv_data, delimiter=",")
242
243 # output summary with threshold 230 # output summary with threshold
244 workbook = xlsxwriter.Workbook(outfile) 231 workbook = xlsxwriter.Workbook(outfile)
245 workbook2 = xlsxwriter.Workbook(outfile2) 232 workbook2 = xlsxwriter.Workbook(outfile2)
246 workbook3 = xlsxwriter.Workbook(outfile3) 233 workbook3 = xlsxwriter.Workbook(outfile3)
247 ws1 = workbook.add_worksheet("Results") 234 ws1 = workbook.add_worksheet("Results")
266 'rel. ref.ab', 'rel. ref.ba', 'rel. alt.ab', 'rel. alt.ba', 253 'rel. ref.ab', 'rel. ref.ba', 'rel. alt.ab', 'rel. alt.ba',
267 'na.ab', 'na.ba', 'lowq.ab', 'lowq.ba', 'trim.ab', 'trim.ba', 254 'na.ab', 'na.ba', 'lowq.ab', 'lowq.ba', 'trim.ab', 'trim.ba',
268 'SSCS alt.ab', 'SSCS alt.ba', 'SSCS ref.ab', 'SSCS ref.ba', 255 'SSCS alt.ab', 'SSCS alt.ba', 'SSCS ref.ab', 'SSCS ref.ba',
269 'in phase', 'chimeric tag') 256 'in phase', 'chimeric tag')
270 ws1.write_row(0, 0, header_line) 257 ws1.write_row(0, 0, header_line)
271 #csv_writer.writerow(header_line)
272 counter_tier11 = 0 258 counter_tier11 = 0
273 counter_tier12 = 0 259 counter_tier12 = 0
274 counter_tier21 = 0 260 counter_tier21 = 0
275 counter_tier22 = 0 261 counter_tier22 = 0
276 counter_tier23 = 0 262 counter_tier23 = 0
278 counter_tier31 = 0 264 counter_tier31 = 0
279 counter_tier32 = 0 265 counter_tier32 = 0
280 counter_tier41 = 0 266 counter_tier41 = 0
281 counter_tier42 = 0 267 counter_tier42 = 0
282 counter_tier5 = 0 268 counter_tier5 = 0
283 counter_tier6 = 0
284 row = 1 269 row = 1
285 tier_dict = {} 270 tier_dict = {}
286 chimera_dict = {} 271 chimera_dict = {}
287 for key1, value1 in sorted(mut_dict.items()): 272 for key1, value1 in sorted(mut_dict.items()):
288 counts_mut = 0 273 counts_mut = 0
294 alt = mut_array[i, 3] 279 alt = mut_array[i, 3]
295 dcs_median = cvrg_dict[key1][2] 280 dcs_median = cvrg_dict[key1][2]
296 whole_array = list(pure_tags_dict_short[key1].keys()) 281 whole_array = list(pure_tags_dict_short[key1].keys())
297 282
298 tier_dict[key1] = {} 283 tier_dict[key1] = {}
299 values_tier_dict = [("tier 1.1", 0), ("tier 1.2", 0), ("tier 2.1", 0), ("tier 2.2", 0), ("tier 2.3", 0), ("tier 2.4", 0), 284 values_tier_dict = [("tier 1.1", 0), ("tier 1.2", 0), ("tier 2.1", 0), ("tier 2.2", 0), ("tier 2.3", 0), ("tier 2.4", 0), ("tier 3.1", 0), ("tier 3.2", 0), ("tier 4.1", 0), ("tier 4.2", 0), ("tier 5", 0)]
300 ("tier 3.1", 0), ("tier 3.2", 0), ("tier 4.1", 0), ("tier 4.2", 0), ("tier 5", 0), ("tier 6", 0)]
301 for k, v in values_tier_dict: 285 for k, v in values_tier_dict:
302 tier_dict[key1][k] = v 286 tier_dict[key1][k] = v
303 287
304 used_keys = [] 288 used_keys = []
305 if 'ab' in mut_pos_dict[key1].keys(): 289 if 'ab' in mut_pos_dict[key1].keys():
513 beg1 = beg4 = beg2 = beg3 = 0 497 beg1 = beg4 = beg2 = beg3 = 0
514 498
515 details1 = (total1, total4, total1new, total4new, ref1, ref4, alt1, alt4, ref1f, ref4f, alt1f, alt4f, na1, na4, lowq1, lowq4, beg1, beg4) 499 details1 = (total1, total4, total1new, total4new, ref1, ref4, alt1, alt4, ref1f, ref4f, alt1f, alt4f, na1, na4, lowq1, lowq4, beg1, beg4)
516 details2 = (total2, total3, total2new, total3new, ref2, ref3, alt2, alt3, ref2f, ref3f, alt2f, alt3f, na2, na3, lowq2, lowq3, beg2, beg3) 500 details2 = (total2, total3, total2new, total3new, ref2, ref3, alt2, alt3, ref2f, ref3f, alt2f, alt3f, na2, na3, lowq2, lowq3, beg2, beg3)
517 501
518 trimmed_five = False 502 trimmed = False
519 trimmed_three = False
520 contradictory = False 503 contradictory = False
521 504
522 if ((all(float(ij) >= 0.5 for ij in [alt1ff, alt4ff]) & all(float(ij) == 0. for ij in [alt2ff, alt3ff])) | (all(float(ij) >= 0.5 for ij in [alt2ff, alt3ff]) & all(float(ij) == 0. for ij in [alt1ff, alt4ff]))): 505 if ((all(float(ij) >= 0.5 for ij in [alt1ff, alt4ff]) & all(float(ij) == 0. for ij in [alt2ff, alt3ff])) | (all(float(ij) >= 0.5 for ij in [alt2ff, alt3ff]) & all(float(ij) == 0. for ij in [alt1ff, alt4ff]))):
523 alt1ff = 0 506 alt1ff = 0
524 alt4ff = 0 507 alt4ff = 0
525 alt2ff = 0 508 alt2ff = 0
526 alt3ff = 0 509 alt3ff = 0
527 trimmed_five = False 510 trimmed = False
528 trimmed_three = False
529 contradictory = True 511 contradictory = True
530 else: 512 else:
531 if ((read_pos1 >= 0) and (read_pos1 <= trim5)): 513 if ((read_pos1 >= 0) and ((read_pos1 <= trim) | (abs(read_len_median1 - read_pos1) <= trim))):
532 beg1 = total1new 514 beg1 = total1new
533 total1new = 0 515 total1new = 0
534 alt1ff = 0 516 alt1ff = 0
535 alt1f = 0 517 alt1f = 0
536 trimmed_five = True 518 trimmed = True
537 519
538 if ((read_pos1 >= 0) and (abs(read_len_median1 - read_pos1) <= trim3)): 520 if ((read_pos4 >= 0) and ((read_pos4 <= trim) | (abs(read_len_median4 - read_pos4) <= trim))):
539 beg1 = total1new
540 total1new = 0
541 alt1ff = 0
542 alt1f = 0
543 trimmed_three = True
544
545 if ((read_pos4 >= 0) and (read_pos4 <= trim5)):
546 beg4 = total4new 521 beg4 = total4new
547 total4new = 0 522 total4new = 0
548 alt4ff = 0 523 alt4ff = 0
549 alt4f = 0 524 alt4f = 0
550 trimmed_five = True 525 trimmed = True
551 526
552 if ((read_pos4 >= 0) and (abs(read_len_median4 - read_pos4) <= trim3)): 527 if ((read_pos2 >= 0) and ((read_pos2 <= trim) | (abs(read_len_median2 - read_pos2) <= trim))):
553 beg4 = total4new
554 total4new = 0
555 alt4ff = 0
556 alt4f = 0
557 trimmed_three = True
558
559 if ((read_pos2 >= 0) and (read_pos2 <= trim5)):
560 beg2 = total2new 528 beg2 = total2new
561 total2new = 0 529 total2new = 0
562 alt2ff = 0 530 alt2ff = 0
563 alt2f = 0 531 alt2f = 0
564 trimmed_five = True 532 trimmed = True
565 533
566 if ((read_pos2 >= 0) and (abs(read_len_median2 - read_pos2) <= trim3)): 534 if ((read_pos3 >= 0) and ((read_pos3 <= trim) | (abs(read_len_median3 - read_pos3) <= trim))):
567 beg2 = total2new
568 total2new = 0
569 alt2ff = 0
570 alt2f = 0
571 trimmed_three = True
572
573 if ((read_pos3 >= 0) and (read_pos3 <= trim5)):
574 beg3 = total3new 535 beg3 = total3new
575 total3new = 0 536 total3new = 0
576 alt3ff = 0 537 alt3ff = 0
577 alt3f = 0 538 alt3f = 0
578 trimmed_five = True 539 trimmed = True
579
580 if ((read_pos3 >= 0) and (abs(read_len_median3 - read_pos3) <= trim3)):
581 beg3 = total3new
582 total3new = 0
583 alt3ff = 0
584 alt3f = 0
585 trimmed_three = True
586
587 details1 = (total1, total4, total1new, total4new, ref1, ref4, alt1, alt4, ref1f, ref4f, alt1f, alt4f, na1, na4, lowq1, lowq4, beg1, beg4) 540 details1 = (total1, total4, total1new, total4new, ref1, ref4, alt1, alt4, ref1f, ref4f, alt1f, alt4f, na1, na4, lowq1, lowq4, beg1, beg4)
588 details2 = (total2, total3, total2new, total3new, ref2, ref3, alt2, alt3, ref2f, ref3f, alt2f, alt3f, na2, na3, lowq2, lowq3, beg2, beg3) 541 details2 = (total2, total3, total2new, total3new, ref2, ref3, alt2, alt3, ref2f, ref3f, alt2f, alt3f, na2, na3, lowq2, lowq3, beg2, beg3)
589 542
590 # assign tiers 543 # assign tiers
591 if ((all(int(ij) >= 3 for ij in [total1new, total4new]) & all(float(ij) >= 0.75 for ij in [alt1ff, alt4ff])) | (all(int(ij) >= 3 for ij in [total2new, total3new]) & all(float(ij) >= 0.75 for ij in [alt2ff, alt3ff]))): 544 if ((all(int(ij) >= 3 for ij in [total1new, total4new]) & all(float(ij) >= 0.75 for ij in [alt1ff, alt4ff])) | (all(int(ij) >= 3 for ij in [total2new, total3new]) & all(float(ij) >= 0.75 for ij in [alt2ff, alt3ff]))):
631 | (all(int(ij) >= 1 for ij in [total2new, total3new]) & all(float(ij) >= 0.5 for ij in [alt2ff, alt3ff]))): 584 | (all(int(ij) >= 1 for ij in [total2new, total3new]) & all(float(ij) >= 0.5 for ij in [alt2ff, alt3ff]))):
632 tier = "3.2" 585 tier = "3.2"
633 counter_tier32 += 1 586 counter_tier32 += 1
634 tier_dict[key1]["tier 3.2"] += 1 587 tier_dict[key1]["tier 3.2"] += 1
635 588
636 elif trimmed_five: 589 elif (trimmed):
637 tier = "4.1" 590 tier = "4.1"
638 counter_tier41 += 1 591 counter_tier41 += 1
639 tier_dict[key1]["tier 4.1"] += 1 592 tier_dict[key1]["tier 4.1"] += 1
640 593
641 elif trimmed_three: 594 elif (contradictory):
642 tier = "4.2" 595 tier = "4.2"
643 counter_tier42 += 1 596 counter_tier42 += 1
644 tier_dict[key1]["tier 4.2"] += 1 597 tier_dict[key1]["tier 4.2"] += 1
645 598
646 elif contradictory: 599 else:
647 tier = "5" 600 tier = "5"
648 counter_tier5 += 1 601 counter_tier5 += 1
649 tier_dict[key1]["tier 5"] += 1 602 tier_dict[key1]["tier 5"] += 1
650 else:
651 tier = "6"
652 counter_tier6 += 1
653 tier_dict[key1]["tier 6"] += 1
654 603
655 chrom, pos, ref_a, alt_a = re.split(r'\#', key1) 604 chrom, pos, ref_a, alt_a = re.split(r'\#', key1)
656 var_id = '-'.join([chrom, str(int(pos) + 1), ref, alt]) 605 var_id = '-'.join([chrom, str(int(pos) + 1), ref, alt])
657 sample_tag = key2[:-5] 606 sample_tag = key2[:-5]
658 array2 = np.unique(whole_array) # remove duplicate sequences to decrease running time 607 array2 = np.unique(whole_array) # remove duplicate sequences to decrease running time
731 read_pos2 = read_len_median2 = None 680 read_pos2 = read_len_median2 = None
732 if (read_pos3 == -1): 681 if (read_pos3 == -1):
733 read_pos3 = read_len_median3 = None 682 read_pos3 = read_len_median3 = None
734 line = (var_id, tier, key2[:-5], 'ab1.ba2', read_pos1, read_pos4, read_len_median1, read_len_median4, dcs_median) + details1 + (sscs_mut_ab, sscs_mut_ba, sscs_ref_ab, sscs_ref_ba, add_mut14, chimera) 683 line = (var_id, tier, key2[:-5], 'ab1.ba2', read_pos1, read_pos4, read_len_median1, read_len_median4, dcs_median) + details1 + (sscs_mut_ab, sscs_mut_ba, sscs_ref_ab, sscs_ref_ba, add_mut14, chimera)
735 ws1.write_row(row, 0, line) 684 ws1.write_row(row, 0, line)
736 #csv_writer.writerow(line)
737 line = ("", "", key2[:-5], 'ab2.ba1', read_pos2, read_pos3, read_len_median2, read_len_median3, dcs_median) + details2 + (sscs_mut_ab, sscs_mut_ba, sscs_ref_ab, sscs_ref_ba, add_mut23, chimera) 685 line = ("", "", key2[:-5], 'ab2.ba1', read_pos2, read_pos3, read_len_median2, read_len_median3, dcs_median) + details2 + (sscs_mut_ab, sscs_mut_ba, sscs_ref_ab, sscs_ref_ba, add_mut23, chimera)
738 ws1.write_row(row + 1, 0, line) 686 ws1.write_row(row + 1, 0, line)
739 #csv_writer.writerow(line)
740 687
741 ws1.conditional_format('L{}:M{}'.format(row + 1, row + 2), 688 ws1.conditional_format('L{}:M{}'.format(row + 1, row + 2),
742 {'type': 'formula', 689 {'type': 'formula',
743 'criteria': '=OR($B${}="1.1", $B${}="1.2")'.format(row + 1, row + 1), 690 'criteria': '=OR($B${}="1.1", $B${}="1.2")'.format(row + 1, row + 1),
744 'format': format1, 691 'format': format1,
765 if high_tiers == len(tiers): 712 if high_tiers == len(tiers):
766 chimeric_dcs_high_tiers += high_tiers - 1 713 chimeric_dcs_high_tiers += high_tiers - 1
767 else: 714 else:
768 chimeric_dcs_high_tiers += high_tiers 715 chimeric_dcs_high_tiers += high_tiers
769 chimera_dict[key1] = (chimeric_dcs, chimeric_dcs_high_tiers) 716 chimera_dict[key1] = (chimeric_dcs, chimeric_dcs_high_tiers)
770 #csv_data.close()
771 717
772 # sheet 2 718 # sheet 2
773 if chimera_correction: 719 if chimera_correction:
774 header_line2 = ('variant ID', 'cvrg', 'AC alt (all tiers)', 'AF (all tiers)', 'chimeras in AC alt (all tiers)', 'chimera-corrected cvrg', 'chimera-corrected AF (all tiers)', 'cvrg (tiers 1.1-2.4)', 'AC alt (tiers 1.1-2.4)', 'AF (tiers 1.1-2.4)', 'chimeras in AC alt (tiers 1.1-2.4)', 'chimera-corrected cvrg (tiers 1.1-2.4)', 'chimera-corrected AF (tiers 1.1-2.4)', 'AC alt (orginal DCS)', 'AF (original DCS)', 720 header_line2 = ('variant ID', 'cvrg', 'AC alt (all tiers)', 'AF (all tiers)', 'chimeras in AC alt (all tiers)', 'chimera-corrected cvrg', 'chimera-corrected AF (all tiers)', 'cvrg (tiers 1.1-2.4)', 'AC alt (tiers 1.1-2.4)', 'AF (tiers 1.1-2.4)', 'chimeras in AC alt (tiers 1.1-2.4)', 'chimera-corrected cvrg (tiers 1.1-2.4)', 'chimera-corrected AF (tiers 1.1-2.4)', 'AC alt (orginal DCS)', 'AF (original DCS)',
775 'tier 1.1', 'tier 1.2', 'tier 2.1', 'tier 2.2', 'tier 2.3', 'tier 2.4', 721 'tier 1.1', 'tier 1.2', 'tier 2.1', 'tier 2.2', 'tier 2.3', 'tier 2.4',
776 'tier 3.1', 'tier 3.2', 'tier 4.1', 'tier 4.2', 'tier 5', 'tier 6', 'AF 1.1-1.2', 'AF 1.1-2.1', 'AF 1.1-2.2', 722 'tier 3.1', 'tier 3.2', 'tier 4.1', 'tier 4.2', 'tier 5', 'AF 1.1-1.2', 'AF 1.1-2.1', 'AF 1.1-2.2',
777 'AF 1.1-2.3', 'AF 1.1-2.4', 'AF 1.1-3.1', 'AF 1.1-3.2', 'AF 1.1-4.1', 'AF 1.1-4.2', 'AF 1.1-5', 'AF 1.1-6') 723 'AF 1.1-2.3', 'AF 1.1-2.4', 'AF 1.1-3.1', 'AF 1.1-3.2', 'AF 1.1-4.1', 'AF 1.1-4.2', 'AF 1.1-5')
778 else: 724 else:
779 header_line2 = ('variant ID', 'cvrg', 'AC alt (all tiers)', 'AF (all tiers)', 'cvrg (tiers 1.1-2.4)', 'AC alt (tiers 1.1-2.4)', 'AF (tiers 1.1-2.4)', 'AC alt (orginal DCS)', 'AF (original DCS)', 725 header_line2 = ('variant ID', 'cvrg', 'AC alt (all tiers)', 'AF (all tiers)', 'cvrg (tiers 1.1-2.4)', 'AC alt (tiers 1.1-2.4)', 'AF (tiers 1.1-2.4)', 'AC alt (orginal DCS)', 'AF (original DCS)',
780 'tier 1.1', 'tier 1.2', 'tier 2.1', 'tier 2.2', 'tier 2.3', 'tier 2.4', 726 'tier 1.1', 'tier 1.2', 'tier 2.1', 'tier 2.2', 'tier 2.3', 'tier 2.4',
781 'tier 3.1', 'tier 3.2', 'tier 4.1', 'tier 4.2', 'tier 5', 'tier 6', 'AF 1.1-1.2', 'AF 1.1-2.1', 'AF 1.1-2.2', 727 'tier 3.1', 'tier 3.2', 'tier 4.1', 'tier 4.2', 'tier 5', 'AF 1.1-1.2', 'AF 1.1-2.1', 'AF 1.1-2.2',
782 'AF 1.1-2.3', 'AF 1.1-2.4', 'AF 1.1-3.1', 'AF 1.1-3.2', 'AF 1.1-4.1', 'AF 1.1-4.2', 'AF 1.1-5', 'AF 1.1-6') 728 'AF 1.1-2.3', 'AF 1.1-2.4', 'AF 1.1-3.1', 'AF 1.1-3.2', 'AF 1.1-4.1', 'AF 1.1-4.2', 'AF 1.1-5')
783 729
784 ws2.write_row(0, 0, header_line2) 730 ws2.write_row(0, 0, header_line2)
785 row = 0 731 row = 0
786 732
787 for key1, value1 in sorted(tier_dict.items()): 733 for key1, value1 in sorted(tier_dict.items()):
812 fraction_chimeras = safe_div(chimeras_all, float(sum(used_tiers))) 758 fraction_chimeras = safe_div(chimeras_all, float(sum(used_tiers)))
813 if fraction_chimeras is None: 759 if fraction_chimeras is None:
814 fraction_chimeras = 0. 760 fraction_chimeras = 0.
815 new_cvrg = cvrg * (1. - fraction_chimeras) 761 new_cvrg = cvrg * (1. - fraction_chimeras)
816 lst.extend([chimeras_all, new_cvrg, safe_div(new_alt, new_cvrg)]) 762 lst.extend([chimeras_all, new_cvrg, safe_div(new_alt, new_cvrg)])
817 lst.extend([(cvrg - sum(used_tiers[-6:])), sum(used_tiers[0:6]), safe_div(sum(used_tiers[0:6]), (cvrg - sum(used_tiers[-6:])))]) 763 lst.extend([(cvrg - sum(used_tiers[-5:])), sum(used_tiers[0:6]), safe_div(sum(used_tiers[0:6]), (cvrg - sum(used_tiers[-5:])))])
818 if chimera_correction: 764 if chimera_correction:
819 chimeras_all = chimera_dict[key1][1] 765 chimeras_all = chimera_dict[key1][1]
820 new_alt = sum(used_tiers[0:6]) - chimeras_all 766 new_alt = sum(used_tiers[0:6]) - chimeras_all
821 fraction_chimeras = safe_div(chimeras_all, float(sum(used_tiers[0:6]))) 767 fraction_chimeras = safe_div(chimeras_all, float(sum(used_tiers[0:6])))
822 if fraction_chimeras is None: 768 if fraction_chimeras is None:
823 fraction_chimeras = 0. 769 fraction_chimeras = 0.
824 new_cvrg = (cvrg - sum(used_tiers[-6:])) * (1. - fraction_chimeras) 770 new_cvrg = (cvrg - sum(used_tiers[-5:])) * (1. - fraction_chimeras)
825 lst.extend([chimeras_all, new_cvrg, safe_div(new_alt, new_cvrg)]) 771 lst.extend([chimeras_all, new_cvrg, safe_div(new_alt, new_cvrg)])
826 lst.extend([alt_count, safe_div(alt_count, cvrg)]) 772 lst.extend([alt_count, safe_div(alt_count, cvrg)])
827 lst.extend(used_tiers) 773 lst.extend(used_tiers)
828 lst.extend(cum_af) 774 lst.extend(cum_af)
829 lst = tuple(lst) 775 lst = tuple(lst)
830 ws2.write_row(row + 1, 0, lst) 776 ws2.write_row(row + 1, 0, lst)
831 if chimera_correction: 777 if chimera_correction:
832 ws2.conditional_format('P{}:Q{}'.format(row + 2, row + 2), {'type': 'formula', 'criteria': '=$P$1="tier 1.1"', 'format': format1, 'multi_range': 'P{}:Q{} P1:Q1'.format(row + 2, row + 2)}) 778 ws2.conditional_format('P{}:Q{}'.format(row + 2, row + 2), {'type': 'formula', 'criteria': '=$P$1="tier 1.1"', 'format': format1, 'multi_range': 'P{}:Q{} P1:Q1'.format(row + 2, row + 2)})
833 ws2.conditional_format('R{}:U{}'.format(row + 2, row + 2), {'type': 'formula', 'criteria': '=$R$1="tier 2.1"', 'format': format3, 'multi_range': 'R{}:U{} R1:U1'.format(row + 2, row + 2)}) 779 ws2.conditional_format('R{}:U{}'.format(row + 2, row + 2), {'type': 'formula', 'criteria': '=$R$1="tier 2.1"', 'format': format3, 'multi_range': 'R{}:U{} R1:U1'.format(row + 2, row + 2)})
834 ws2.conditional_format('V{}:AA{}'.format(row + 2, row + 2), {'type': 'formula', 'criteria': '=$V$1="tier 3.1"', 'format': format2, 'multi_range': 'V{}:AA{} V1:AA1'.format(row + 2, row + 2)}) 780 ws2.conditional_format('V{}:Z{}'.format(row + 2, row + 2), {'type': 'formula', 'criteria': '=$V$1="tier 3.1"', 'format': format2, 'multi_range': 'V{}:Z{} V1:Z1'.format(row + 2, row + 2)})
835 else: 781 else:
836 ws2.conditional_format('J{}:K{}'.format(row + 2, row + 2), {'type': 'formula', 'criteria': '=$J$1="tier 1.1"', 'format': format1, 'multi_range': 'J{}:K{} J1:K1'.format(row + 2, row + 2)}) 782 ws2.conditional_format('J{}:K{}'.format(row + 2, row + 2), {'type': 'formula', 'criteria': '=$J$1="tier 1.1"', 'format': format1, 'multi_range': 'J{}:K{} J1:K1'.format(row + 2, row + 2)})
837 ws2.conditional_format('L{}:O{}'.format(row + 2, row + 2), {'type': 'formula', 'criteria': '=$L$1="tier 2.1"', 'format': format3, 'multi_range': 'L{}:O{} L1:O1'.format(row + 2, row + 2)}) 783 ws2.conditional_format('L{}:O{}'.format(row + 2, row + 2), {'type': 'formula', 'criteria': '=$L$1="tier 2.1"', 'format': format3, 'multi_range': 'L{}:O{} L1:O1'.format(row + 2, row + 2)})
838 ws2.conditional_format('P{}:U{}'.format(row + 2, row + 2), {'type': 'formula', 'criteria': '=$P$1="tier 3.1"', 'format': format2, 'multi_range': 'P{}:U{} P1:U1'.format(row + 2, row + 2)}) 784 ws2.conditional_format('P{}:T{}'.format(row + 2, row + 2), {'type': 'formula', 'criteria': '=$P$1="tier 3.1"', 'format': format2, 'multi_range': 'P{}:T{} P1:T1'.format(row + 2, row + 2)})
839 row += 1 785 row += 1
840 786
841 # sheet 3 787 # sheet 3
842 sheet3 = [("tier 1.1", counter_tier11), ("tier 1.2", counter_tier12), ("tier 2.1", counter_tier21), 788 sheet3 = [("tier 1.1", counter_tier11), ("tier 1.2", counter_tier12), ("tier 2.1", counter_tier21),
843 ("tier 2.2", counter_tier22), ("tier 2.3", counter_tier23), ("tier 2.4", counter_tier24), 789 ("tier 2.2", counter_tier22), ("tier 2.3", counter_tier23), ("tier 2.4", counter_tier24),
844 ("tier 3.1", counter_tier31), ("tier 3.2", counter_tier32), ("tier 4.1", counter_tier41), 790 ("tier 3.1", counter_tier31), ("tier 3.2", counter_tier32), ("tier 4.1", counter_tier41),
845 ("tier 4.2", counter_tier42), ("tier 5", counter_tier5), ("tier 6", counter_tier6)] 791 ("tier 4.2", counter_tier42), ("tier 5", counter_tier5)]
846 792
847 header = ("tier", "count") 793 header = ("tier", "count")
848 ws3.write_row(0, 0, header) 794 ws3.write_row(0, 0, header)
849 795
850 for i in range(len(sheet3)): 796 for i in range(len(sheet3)):
857 {'type': 'formula', 803 {'type': 'formula',
858 'criteria': '=OR($A${}="tier 2.1", $A${}="tier 2.2", $A${}="tier 2.3", $A${}="tier 2.4")'.format(i + 2, i + 2, i + 2, i + 2), 804 'criteria': '=OR($A${}="tier 2.1", $A${}="tier 2.2", $A${}="tier 2.3", $A${}="tier 2.4")'.format(i + 2, i + 2, i + 2, i + 2),
859 'format': format3}) 805 'format': format3})
860 ws3.conditional_format('A{}:B{}'.format(i + 2, i + 2), 806 ws3.conditional_format('A{}:B{}'.format(i + 2, i + 2),
861 {'type': 'formula', 807 {'type': 'formula',
862 'criteria': '=OR($A${}="tier 3.1", $A${}="tier 3.2", $A${}="tier 4.1", $A${}="tier 4.2", $A${}="tier 5", $A${}="tier 6")'.format(i + 2, i + 2, i + 2, i + 2, i + 2, i + 2), 808 'criteria': '=$A${}>="3"'.format(i + 2),
863 'format': format2}) 809 'format': format2})
864 810
865 description_tiers = [("Tier 1.1", "both ab and ba SSCS present (>75% of the sites with alternative base) and minimal FS>=3 for both SSCS in at least one mate"), ("", ""), 811 description_tiers = [("Tier 1.1", "both ab and ba SSCS present (>75% of the sites with alternative base) and minimal FS>=3 for both SSCS in at least one mate"), ("", ""), ("Tier 1.2", "both ab and ba SSCS present (>75% of the sites with alt. base) and mate pair validation (min. FS=1) and minimal FS>=3 for at least one of the SSCS"), ("Tier 2.1", "both ab and ba SSCS present (>75% of the sites with alt. base) and minimal FS>=3 for at least one of the SSCS in at least one mate"), ("Tier 2.2", "both ab and ba SSCS present (>75% of the sites with alt. base) and mate pair validation (min. FS=1)"), ("Tier 2.3", "both ab and ba SSCS present (>75% of the sites with alt. base) and minimal FS=1 for both SSCS in one mate and minimal FS>=3 for at least one of the SSCS in the other mate"), ("Tier 2.4", "both ab and ba SSCS present (>75% of the sites with alt. base) and minimal FS=1 for both SSCS in at least one mate"), ("Tier 3.1", "both ab and ba SSCS present (>50% of the sites with alt. base) and recurring mutation on this position"), ("Tier 3.2", "both ab and ba SSCS present (>50% of the sites with alt. base) and minimal FS>=1 for both SSCS in at least one mate"), ("Tier 4.1", "variants at the start or end of the reads"), ("Tier 4.2", "mates with contradictory information"), ("Tier 5", "remaining variants")]
866 ("Tier 1.2", "both ab and ba SSCS present (>75% of the sites with alt. base) and mate pair validation (min. FS=1) and minimal FS>=3 for at least one of the SSCS"), 812 examples_tiers = [[("Chr5:5-20000-11068-C-G", "1.1", "AAAAAGATGCCGACTACCTT", "ab1.ba2", "254", "228", "287", "288", "289",
867 ("Tier 2.1", "both ab and ba SSCS present (>75% of the sites with alt. base) and minimal FS>=3 for at least one of the SSCS in at least one mate"),
868 ("Tier 2.2", "both ab and ba SSCS present (>75% of the sites with alt. base) and mate pair validation (min. FS=1)"),
869 ("Tier 2.3", "both ab and ba SSCS present (>75% of the sites with alt. base) and minimal FS=1 for both SSCS in one mate and minimal FS>=3 for at least one of the SSCS in the other mate"),
870 ("Tier 2.4", "both ab and ba SSCS present (>75% of the sites with alt. base) and minimal FS=1 for both SSCS in at least one mate"),
871 ("Tier 3.1", "both ab and ba SSCS present (>50% of the sites with alt. base) and recurring mutation on this position"),
872 ("Tier 3.2", "both ab and ba SSCS present (>50% of the sites with alt. base) and minimal FS>=1 for both SSCS in at least one mate"),
873 ("Tier 4.1", "variants at the beginning of the reads"),
874 ("Tier 4.2", "variants at the end of the reads"),
875 ("Tier 5", "mates with contradictory information"),
876 ("Tier 6", "remaining variants")]
877 examples_tiers = [[("chr5-11068-C-G", "1.1", "AAAAAGATGCCGACTACCTT", "ab1.ba2", "254", "228", "287", "288", "289",
878 "3", "6", "3", "6", "0", "0", "3", "6", "0", "0", "1", "1", "0", "0", "0", "0", "0", "0", 813 "3", "6", "3", "6", "0", "0", "3", "6", "0", "0", "1", "1", "0", "0", "0", "0", "0", "0",
879 "4081", "4098", "5", "10", "", ""), 814 "4081", "4098", "5", "10", "", ""),
880 ("", "", "AAAAAGATGCCGACTACCTT", "ab2.ba1", None, None, None, None, 815 ("", "", "AAAAAGATGCCGACTACCTT", "ab2.ba1", None, None, None, None,
881 "289", "0", "0", "0", "0", "0", "0", "0", "0", None, None, None, None, 816 "289", "0", "0", "0", "0", "0", "0", "0", "0", None, None, None, None,
882 "0", "0", "0", "0", "0", "0", "4081", "4098", "5", "10", "", "")], 817 "0", "0", "0", "0", "0", "0", "4081", "4098", "5", "10", "", "")],
883 [("chr5-11068-C-G", "1.1", "AAAAATGCGTAGAAATATGC", "ab1.ba2", "254", "228", "287", "288", "289", 818 [("Chr5:5-20000-11068-C-G", "1.1", "AAAAATGCGTAGAAATATGC", "ab1.ba2", "254", "228", "287", "288", "289",
884 "33", "43", "33", "43", "0", "0", "33", "43", "0", "0", "1", "1", "0", "0", "0", "0", "0", 819 "33", "43", "33", "43", "0", "0", "33", "43", "0", "0", "1", "1", "0", "0", "0", "0", "0",
885 "0", "4081", "4098", "5", "10", "", ""), 820 "0", "4081", "4098", "5", "10", "", ""),
886 ("", "", "AAAAATGCGTAGAAATATGC", "ab2.ba1", "268", "268", "270", "288", "289", 821 ("", "", "AAAAATGCGTAGAAATATGC", "ab2.ba1", "268", "268", "270", "288", "289",
887 "11", "34", "10", "27", "0", "0", "10", "27", "0", "0", "1", "1", "0", "0", "1", 822 "11", "34", "10", "27", "0", "0", "10", "27", "0", "0", "1", "1", "0", "0", "1",
888 "7", "0", "0", "4081", "4098", "5", "10", "", "")], 823 "7", "0", "0", "4081", "4098", "5", "10", "", "")],
889 [("chr5-10776-G-T", "1.2", "CTATGACCCGTGAGCCCATG", "ab1.ba2", "132", "132", "287", "288", "290", 824 [("Chr5:5-20000-10776-G-T", "1.2", "CTATGACCCGTGAGCCCATG", "ab1.ba2", "132", "132", "287", "288", "290",
890 "4", "1", "4", "1", "0", "0", "4", "1", "0", "0", "1", "1", "0", "0", "0", "0", 825 "4", "1", "4", "1", "0", "0", "4", "1", "0", "0", "1", "1", "0", "0", "0", "0",
891 "0", "0", "1", "6", "47170", "41149", "", ""), 826 "0", "0", "1", "6", "47170", "41149", "", ""),
892 ("", "", "CTATGACCCGTGAGCCCATG", "ab2.ba1", "77", "132", "233", "200", "290", 827 ("", "", "CTATGACCCGTGAGCCCATG", "ab2.ba1", "77", "132", "233", "200", "290",
893 "4", "1", "4", "1", "0", "0", "4", "1", "0", "0", "1", "1", "0", "0", "0", "0", 828 "4", "1", "4", "1", "0", "0", "4", "1", "0", "0", "1", "1", "0", "0", "0", "0",
894 "0", "0", "1", "6", "47170", "41149", "", "")], 829 "0", "0", "1", "6", "47170", "41149", "", "")],
895 [("chr5-11068-C-G", "2.1", "AAAAAAACATCATACACCCA", "ab1.ba2", "246", "244", "287", "288", "289", 830 [("Chr5:5-20000-11068-C-G", "2.1", "AAAAAAACATCATACACCCA", "ab1.ba2", "246", "244", "287", "288", "289",
896 "2", "8", "2", "8", "0", "0", "2", "8", "0", "0", "1", "1", "0", "0", "0", "0", "0", "0", 831 "2", "8", "2", "8", "0", "0", "2", "8", "0", "0", "1", "1", "0", "0", "0", "0", "0", "0",
897 "4081", "4098", "5", "10", "", ""), 832 "4081", "4098", "5", "10", "", ""),
898 ("", "", "AAAAAAACATCATACACCCA", "ab2.ba1", None, None, None, None, 833 ("", "", "AAAAAAACATCATACACCCA", "ab2.ba1", None, None, None, None,
899 "289", "0", "0", "0", "0", "0", "0", "0", "0", None, None, None, None, "0", "0", 834 "289", "0", "0", "0", "0", "0", "0", "0", "0", None, None, None, None, "0", "0",
900 "0", "0", "0", "0", "4081", "4098", "5", "10", "", "")], 835 "0", "0", "0", "0", "4081", "4098", "5", "10", "", "")],
901 [("chr5-11068-C-G", "2.2", "ATCAGCCATGGCTATTATTG", "ab1.ba2", "72", "72", "217", "288", "289", 836 [("Chr5:5-20000-11068-C-G", "2.2", "ATCAGCCATGGCTATTATTG", "ab1.ba2", "72", "72", "217", "288", "289",
902 "1", "1", "1", "1", "0", "0", "1", "1", "0", "0", "1", "1", "0", "0", "0", "0", "0", "0", 837 "1", "1", "1", "1", "0", "0", "1", "1", "0", "0", "1", "1", "0", "0", "0", "0", "0", "0",
903 "4081", "4098", "5", "10", "", ""), 838 "4081", "4098", "5", "10", "", ""),
904 ("", "", "ATCAGCCATGGCTATTATTG", "ab2.ba1", "153", "164", "217", "260", "289", 839 ("", "", "ATCAGCCATGGCTATTATTG", "ab2.ba1", "153", "164", "217", "260", "289",
905 "1", "1", "1", "1", "0", "0", "1", "1", "0", "0", "1", "1", "0", "0", "0", "0", "0", "0", 840 "1", "1", "1", "1", "0", "0", "1", "1", "0", "0", "1", "1", "0", "0", "0", "0", "0", "0",
906 "4081", "4098", "5", "10", "", "")], 841 "4081", "4098", "5", "10", "", "")],
907 [("chr5-11068-C-G", "2.3", "ATCAATATGGCCTCGCCACG", "ab1.ba2", None, None, None, None, 842 [("Chr5:5-20000-11068-C-G", "2.3", "ATCAATATGGCCTCGCCACG", "ab1.ba2", None, None, None, None,
908 "289", "0", "5", "0", "5", "0", "0", "0", "5", None, None, None, "1", "0", 843 "289", "0", "5", "0", "5", "0", "0", "0", "5", None, None, None, "1", "0",
909 "0", "0", "0", "0", "0", "4081", "4098", "5", "10", "", ""), 844 "0", "0", "0", "0", "0", "4081", "4098", "5", "10", "", ""),
910 ("", "", "ATCAATATGGCCTCGCCACG", "ab2.ba1", "202", "255", "277", "290", "289", 845 ("", "", "ATCAATATGGCCTCGCCACG", "ab2.ba1", "202", "255", "277", "290", "289",
911 "1", "3", "1", "3", "0", "0", "1", "3", "0", "0", "1", "1", "0", "0", "0", "0", 846 "1", "3", "1", "3", "0", "0", "1", "3", "0", "0", "1", "1", "0", "0", "0", "0",
912 "0", "0", "4081", "4098", "5", "10", "", "")], 847 "0", "0", "4081", "4098", "5", "10", "", "")],
913 [("chr5-11068-C-G", "2.4", "ATCAGCCATGGCTATTTTTT", "ab1.ba2", "72", "72", "217", "288", "289", 848 [("Chr5:5-20000-11068-C-G", "2.4", "ATCAGCCATGGCTATTTTTT", "ab1.ba2", "72", "72", "217", "288", "289",
914 "1", "1", "1", "1", "0", "0", "1", "1", "0", "0", "1", "1", "0", "0", "0", "0", "0", "0", "4081", 849 "1", "1", "1", "1", "0", "0", "1", "1", "0", "0", "1", "1", "0", "0", "0", "0", "0", "0", "4081",
915 "4098", "5", "10", "", ""), 850 "4098", "5", "10", "", ""),
916 ("", "", "ATCAGCCATGGCTATTTTTT", "ab2.ba1", "153", "164", "217", "260", "289", 851 ("", "", "ATCAGCCATGGCTATTTTTT", "ab2.ba1", "153", "164", "217", "260", "289",
917 "1", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "1", "0", "0", "0", "0", "4081", 852 "1", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "1", "0", "0", "0", "0", "4081",
918 "4098", "5", "10", "", "")], 853 "4098", "5", "10", "", "")],
919 [("chr5-10776-G-T", "3.1", "ATGCCTACCTCATTTGTCGT", "ab1.ba2", "46", "15", "287", "288", "290", 854 [("Chr5:5-20000-10776-G-T", "3.1", "ATGCCTACCTCATTTGTCGT", "ab1.ba2", "46", "15", "287", "288", "290",
920 "3", "3", "3", "2", "3", "1", "0", "1", "1", "0.5", "0", "0.5", "0", "0", "0", "1", 855 "3", "3", "3", "2", "3", "1", "0", "1", "1", "0.5", "0", "0.5", "0", "0", "0", "1",
921 "0", "0", "3", "3", "47170", "41149", "", ""), 856 "0", "0", "3", "3", "47170", "41149", "", ""),
922 ("", "", "ATGCCTACCTCATTTGTCGT", "ab2.ba1", None, "274", None, 857 ("", "", "ATGCCTACCTCATTTGTCGT", "ab2.ba1", None, "274", None,
923 "288", "290", "0", "3", "0", "2", "0", "1", "0", "1", None, "0.5", None, "0.5", 858 "288", "290", "0", "3", "0", "2", "0", "1", "0", "1", None, "0.5", None, "0.5",
924 "0", "0", "0", "1", "0", "0", "3", "3", "47170", "41149", "", "")], 859 "0", "0", "0", "1", "0", "0", "3", "3", "47170", "41149", "", "")],
925 [("chr5-11315-C-T", "3.2", "ACAACATCACGTATTCAGGT", "ab1.ba2", "197", "197", "240", "255", "271", 860 [("Chr5:5-20000-11315-C-T", "3.2", "ACAACATCACGTATTCAGGT", "ab1.ba2", "197", "197", "240", "255", "271",
926 "2", "3", "2", "3", "0", "1", "2", "2", "0", "0.333333333333333", "1", 861 "2", "3", "2", "3", "0", "1", "2", "2", "0", "0.333333333333333", "1",
927 "0.666666666666667", "0", "0", "0", "0", "0", "0", "1", "1", "6584", "6482", "", ""), 862 "0.666666666666667", "0", "0", "0", "0", "0", "0", "1", "1", "6584", "6482", "", ""),
928 ("", "", "ACAACATCACGTATTCAGGT", "ab2.ba1", "35", "35", "240", "258", "271", 863 ("", "", "ACAACATCACGTATTCAGGT", "ab2.ba1", "35", "35", "240", "258", "271",
929 "2", "3", "2", "3", "0", "1", "2", "2", "0", "0.333333333333333", "1", 864 "2", "3", "2", "3", "0", "1", "2", "2", "0", "0.333333333333333", "1",
930 "0.666666666666667", "0", "0", "0", "0", "0", "0", "1", "1", "6584", "6482", "", "")], 865 "0.666666666666667", "0", "0", "0", "0", "0", "0", "1", "1", "6584", "6482", "", "")],
931 [("chr5-13983-G-C", "4.1", "AAAAAAAGAATAACCCACAC", "ab1.ba2", "1", "5", "255", "276", "269", 866 [("Chr5:5-20000-13983-G-C", "4.1", "AAAAAAAGAATAACCCACAC", "ab1.ba2", "0", "100", "255", "276", "269",
932 "5", "6", "0", "6", "0", "0", "5", "6", "0", "0", "0", "1", "0", "0", "0", "0", "5", "0", "1", "1", "5348", "5350", "", ""), 867 "5", "6", "0", "6", "0", "0", "5", "6", "0", "0", "0", "1", "0", "0", "0", "0", "5", "0", "1", "1", "5348", "5350", "", ""),
933 ("", "", "AAAAAAAGAATAACCCACAC", "ab2.ba1", None, None, None, None, 868 ("", "", "AAAAAAAGAATAACCCACAC", "ab2.ba1", None, None, None, None,
934 "269", "0", "0", "0", "0", "0", "0", "0", "0", None, None, None, None, "0", 869 "269", "0", "0", "0", "0", "0", "0", "0", "0", None, None, None, None, "0",
935 "0", "0", "0", "0", "0", "1", "1", "5348", "5350", "", "")], 870 "0", "0", "0", "0", "0", "1", "1", "5348", "5350", "", "")],
936 [("chr5-13983-G-C", "4.2", "AAAAAAAGAATAACCCACAC", "ab1.ba2", "250", "270", "255", "276", "269", 871 [("Chr5:5-20000-13963-T-C", "4.2", "TTTTTAAGAATAACCCACAC", "ab1.ba2", "38", "38", "240", "283", "263",
937 "5", "6", "0", "6", "0", "0", "5", "6", "0", "0", "0", "1", "0", "0", "0", "0", "5", "0", "1", "1", "5348", "5350", "", ""),
938 ("", "", "AAAAAAAGAATAACCCACAC", "ab2.ba1", None, None, None, None,
939 "269", "0", "0", "0", "0", "0", "0", "0", "0", None, None, None, None, "0",
940 "0", "0", "0", "0", "0", "1", "1", "5348", "5350", "", "")],
941 [("chr5-13963-T-C", "5", "TTTTTAAGAATAACCCACAC", "ab1.ba2", "38", "38", "240", "283", "263",
942 "110", "54", "110", "54", "0", "0", "110", "54", "0", "0", "1", "1", "0", "0", "0", 872 "110", "54", "110", "54", "0", "0", "110", "54", "0", "0", "1", "1", "0", "0", "0",
943 "0", "0", "0", "1", "1", "5348", "5350", "", ""), 873 "0", "0", "0", "1", "1", "5348", "5350", "", ""),
944 ("", "", "TTTTTAAGAATAACCCACAC", "ab2.ba1", "100", "112", "140", "145", "263", 874 ("", "", "TTTTTAAGAATAACCCACAC", "ab2.ba1", "100", "112", "140", "145", "263",
945 "7", "12", "7", "12", "7", "12", "0", "0", "1", "1", "0", 875 "7", "12", "7", "12", "7", "12", "0", "0", "1", "1", "0",
946 "0", "0", "0", "0", "0", "0", "0", "1", "1", "5348", "5350", "", "")], 876 "0", "0", "0", "0", "0", "0", "0", "1", "1", "5348", "5350", "", "")],
947 [("chr5-13983-G-C", "6", "ATGTTGTGAATAACCCACAC", "ab1.ba2", None, "186", None, "276", "269", 877 [("Chr5:5-20000-13983-G-C", "5", "ATGTTGTGAATAACCCACAC", "ab1.ba2", None, "186", None, "276", "269",
948 "0", "6", "0", "6", "0", "0", "0", "6", "0", "0", "0", "1", "0", "0", "0", "0", "0", 878 "0", "6", "0", "6", "0", "0", "0", "6", "0", "0", "0", "1", "0", "0", "0", "0", "0",
949 "0", "1", "1", "5348", "5350", "", ""), 879 "0", "1", "1", "5348", "5350", "", ""),
950 ("", "", "ATGTTGTGAATAACCCACAC", "ab2.ba1", None, None, None, None, 880 ("", "", "ATGTTGTGAATAACCCACAC", "ab2.ba1", None, None, None, None,
951 "269", "0", "0", "0", "0", "0", "0", "0", "0", None, None, None, None, "0", 881 "269", "0", "0", "0", "0", "0", "0", "0", "0", None, None, None, None, "0",
952 "0", "0", "0", "0", "0", "1", "1", "5348", "5350", "", "")]] 882 "0", "0", "0", "0", "0", "1", "1", "5348", "5350", "", "")]]
972 'multi_range': 'L{}:M{} T{}:U{} B{}'.format(start_row + 2 + row + i + k + 2, start_row + 2 + row + i + k + 3, start_row + 2 + row + i + k + 2, start_row + 2 + row + i + k + 3, start_row + 2 + row + i + k + 2)}) 902 'multi_range': 'L{}:M{} T{}:U{} B{}'.format(start_row + 2 + row + i + k + 2, start_row + 2 + row + i + k + 3, start_row + 2 + row + i + k + 2, start_row + 2 + row + i + k + 3, start_row + 2 + row + i + k + 2)})
973 row += 3 903 row += 3
974 workbook.close() 904 workbook.close()
975 workbook2.close() 905 workbook2.close()
976 workbook3.close() 906 workbook3.close()
977
978 907
979 908
980 if __name__ == '__main__': 909 if __name__ == '__main__':
981 sys.exit(read2mut(sys.argv)) 910 sys.exit(read2mut(sys.argv))