Mercurial > repos > mheinzl > variant_analyzer2
comparison read2mut.py @ 26:5cb0bdd578cf 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:48:12 +0000 |
parents | 6ee7044d93b0 |
children | 5992e30ae50e |
comparison
equal
deleted
inserted
replaced
25:6ee7044d93b0 | 26:5cb0bdd578cf |
---|---|
235 if len(value) < thresh: | 235 if len(value) < thresh: |
236 pure_tags_dict_short[key] = value | 236 pure_tags_dict_short[key] = value |
237 else: | 237 else: |
238 pure_tags_dict_short = pure_tags_dict | 238 pure_tags_dict_short = pure_tags_dict |
239 | 239 |
240 csv_data = open(outputFile_csv, "w") | 240 #csv_data = open(outputFile_csv, "w") |
241 csv_writer = csv.writer(csv_data, delimiter=",") | 241 #csv_writer = csv.writer(csv_data, delimiter=",") |
242 | 242 |
243 # output summary with threshold | 243 # output summary with threshold |
244 workbook = xlsxwriter.Workbook(outfile) | 244 workbook = xlsxwriter.Workbook(outfile) |
245 workbook2 = xlsxwriter.Workbook(outfile2) | 245 workbook2 = xlsxwriter.Workbook(outfile2) |
246 workbook3 = xlsxwriter.Workbook(outfile3) | 246 workbook3 = xlsxwriter.Workbook(outfile3) |
266 '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', |
267 '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', |
268 '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', |
269 'in phase', 'chimeric tag') | 269 'in phase', 'chimeric tag') |
270 ws1.write_row(0, 0, header_line) | 270 ws1.write_row(0, 0, header_line) |
271 csv_writer.writerow(header_line) | 271 #csv_writer.writerow(header_line) |
272 counter_tier11 = 0 | 272 counter_tier11 = 0 |
273 counter_tier12 = 0 | 273 counter_tier12 = 0 |
274 counter_tier21 = 0 | 274 counter_tier21 = 0 |
275 counter_tier22 = 0 | 275 counter_tier22 = 0 |
276 counter_tier23 = 0 | 276 counter_tier23 = 0 |
731 read_pos2 = read_len_median2 = None | 731 read_pos2 = read_len_median2 = None |
732 if (read_pos3 == -1): | 732 if (read_pos3 == -1): |
733 read_pos3 = read_len_median3 = None | 733 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) | 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) |
735 ws1.write_row(row, 0, line) | 735 ws1.write_row(row, 0, line) |
736 csv_writer.writerow(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) | 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) |
738 ws1.write_row(row + 1, 0, line) | 738 ws1.write_row(row + 1, 0, line) |
739 csv_writer.writerow(line) | 739 #csv_writer.writerow(line) |
740 | 740 |
741 ws1.conditional_format('L{}:M{}'.format(row + 1, row + 2), | 741 ws1.conditional_format('L{}:M{}'.format(row + 1, row + 2), |
742 {'type': 'formula', | 742 {'type': 'formula', |
743 '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), |
744 'format': format1, | 744 'format': format1, |
765 if high_tiers == len(tiers): | 765 if high_tiers == len(tiers): |
766 chimeric_dcs_high_tiers += high_tiers - 1 | 766 chimeric_dcs_high_tiers += high_tiers - 1 |
767 else: | 767 else: |
768 chimeric_dcs_high_tiers += high_tiers | 768 chimeric_dcs_high_tiers += high_tiers |
769 chimera_dict[key1] = (chimeric_dcs, chimeric_dcs_high_tiers) | 769 chimera_dict[key1] = (chimeric_dcs, chimeric_dcs_high_tiers) |
770 csv_writer.close() | 770 #csv_data.close() |
771 | 771 |
772 # sheet 2 | 772 # sheet 2 |
773 if chimera_correction: | 773 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)', | 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)', |
775 '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', |
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', | 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', |