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