diff read2mut.py @ 57:706bf8b59eae draft

planemo upload for repository https://github.com/Single-Molecule-Genetics/VariantAnalyzerGalaxy/tree/master/tools/variant_analyzer commit ee4a8e6cf290e6c8a4d55f9cd2839d60ab3b11c8
author mheinzl
date Fri, 12 Mar 2021 14:29:17 +0000
parents 371c09d4050b
children 04741369fc07
line wrap: on
line diff
--- a/read2mut.py	Fri Mar 12 14:22:03 2021 +0000
+++ b/read2mut.py	Fri Mar 12 14:29:17 2021 +0000
@@ -317,12 +317,14 @@
     row = 1
     tier_dict = {}
     chimera_dict = {}
-    change_tier_after_print = {}
+    #change_tier_after_print = {}
     for key1, value1 in sorted(mut_dict.items()):
         counts_mut = 0
         chimeric_tag_list = []
         chimeric_tag = {}
         if key1 in pure_tags_dict_short.keys():
+            change_tier_after_print = []
+
             i = np.where(np.array(['#'.join(str(i) for i in z)
                                    for z in zip(mut_array[:, 0], mut_array[:, 1], mut_array[:, 2], mut_array[:, 3])]) == key1)[0][0]
             ref = mut_array[i, 2]
@@ -1060,10 +1062,10 @@
                         #                        'format': format2,
                         #                        'multi_range': 'L{}:M{} T{}:U{} B{}'.format(row + 1, row + 2, row + 1, row + 2, row + 1, row + 2)})
                         #if trimmed:
-                        if key1 not in list(change_tier_after_print.keys()):
-                            change_tier_after_print[key1] = [((row, line, line2))]
-                        else:
-                            change_tier_after_print[key1].append(((row, line, line2)))
+                        #if key1 not in list(change_tier_after_print.keys()):
+                        #    change_tier_after_print[key1] = [((row, line, line2))]
+                        #else:
+                        change_tier_after_print.append((row, line, line2))
 
                         row += 3
 
@@ -1092,9 +1094,9 @@
                 tier_dict[key1]["tier 4"] = 0
                 correct_tier = True
 
-            lines = change_tier_after_print[key1]
-            for sample in lines:
-                row = sample[0]
+            #lines = change_tier_after_print[key1]
+            for sample in change_tier_after_print:
+                row_number = sample[0]
                 line1 = sample[1]
                 line2 = sample[2]
 
@@ -1102,9 +1104,9 @@
                     line1 = list(line1)
                     line1[1] = "2.5"
                     line1 = tuple(line1)
-                ws1.write_row(row, 0, line1)
+                ws1.write_row(row_number, 0, line1)
                 csv_writer.writerow(line1)
-                ws1.write_row(row + 1, 0, line2)
+                ws1.write_row(row_number + 1, 0, line2)
                 csv_writer.writerow(line2)
 
                 ws1.conditional_format('L{}:M{}'.format(row + 1, row + 2),