File: 2to3.patch

package info (click to toggle)
assemblytics 1.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 416 kB
  • sloc: python: 564; perl: 234; php: 124; sh: 94; makefile: 11
file content (198 lines) | stat: -rw-r--r-- 9,016 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
Description: Use 2to3 to port to Python3
Bug-Debian: https://bugs.debian.org/936156
Author: Andreas Tille <tille@debian.org>
Last-Update: Sun, 01 Sep 2019 10:47:09 +0200

diff --git a/bin/Assemblytics_index.py b/bin/Assemblytics_index.py
index c1d2515..4208799 100755
--- a/bin/Assemblytics_index.py
+++ b/bin/Assemblytics_index.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/python3
 
 # Author: Maria Nattestad
 # Email: mnattest@cshl.edu
diff --git a/bin/Assemblytics_summary.py b/bin/Assemblytics_summary.py
index 44fc6a5..d35dcb8 100755
--- a/bin/Assemblytics_summary.py
+++ b/bin/Assemblytics_summary.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 
 
 # Author: Maria Nattestad
@@ -65,12 +65,12 @@ def SVtable(args):
             overall_total_bases += sum(sizes)
             overall_total_SVs += len(sizes[sizes>=SV_size])
             overall_total_SV_bases += sum(sizes[sizes>=SV_size])
-            print svType
+            print(svType)
             f_output_csv.write(svType + "\n")
             
             format = "%20s%10s%15s"
 
-            print format % ("", "Count","Total bp")
+            print(format % ("", "Count","Total bp"))
             f_output_csv.write("Size range,Count,Total bp\n")
 
             previous_size = minimum_variant_size
@@ -78,27 +78,27 @@ def SVtable(args):
                 if threshold <= minimum_variant_size or previous_size >= maximum_variant_size:
                     continue
                 subset = sizes[np.logical_and(sizes>=previous_size,sizes<threshold)]; 
-                print format % ("%s-%s bp: " % (intWithCommas(previous_size),intWithCommas(threshold)), str(len(subset)), str(sum(subset)))
+                print(format % ("%s-%s bp: " % (intWithCommas(previous_size),intWithCommas(threshold)), str(len(subset)), str(sum(subset))))
                 f_output_csv.write("%s,%s,%s\n" % ("%s-%s bp" % (previous_size,threshold), str(len(subset)), str(sum(subset))))
                 previous_size = threshold
 
             if previous_size < maximum_variant_size:
                 subset = sizes[sizes>=previous_size];    
-                print format % ("> %s bp: " % (intWithCommas(previous_size)), str(len(subset)), str(sum(subset)))
+                print(format % ("> %s bp: " % (intWithCommas(previous_size)), str(len(subset)), str(sum(subset))))
                 f_output_csv.write("%s,%s,%s\n" % ("> %s bp" % (previous_size), str(len(subset)), str(sum(subset))))
 
-            print format % ("Total: ",str(len(sizes)),str(sum(sizes))) + "\n"
+            print(format % ("Total: ",str(len(sizes)),str(sum(sizes))) + "\n")
             f_output_csv.write("%s,%s,%s\n\n" % ("Total",str(len(sizes)),str(sum(sizes))))
     else:
-        print "No variants found. Plots depicting variant size distributions will also be missing.\n"
+        print("No variants found. Plots depicting variant size distributions will also be missing.\n")
 
-    print "Total number of all variants: %s" % (intWithCommas(overall_total))
+    print("Total number of all variants: %s" % (intWithCommas(overall_total)))
     f_output_csv.write("Total for all variants,%s,%s bp\n" % (overall_total,int(overall_total_bases)))
-    print "Total bases affected by all variants: %s" % (gig_meg(int(overall_total_bases)))
+    print("Total bases affected by all variants: %s" % (gig_meg(int(overall_total_bases))))
 
-    print "Total number of structural variants: %s" % (intWithCommas(overall_total_SVs))
+    print("Total number of structural variants: %s" % (intWithCommas(overall_total_SVs)))
     f_output_csv.write("Total for all structural variants,%s,%s bp\n" % (overall_total_SVs,int(overall_total_SV_bases))  )
-    print "Total bases affected by structural variants: %s" % (gig_meg(int(overall_total_SV_bases)))
+    print("Total bases affected by structural variants: %s" % (gig_meg(int(overall_total_SV_bases))))
 
     f_output_csv.close()
 
@@ -118,7 +118,7 @@ def gig_meg(number,digits = 2):
 
 
 def intWithCommas(x):
-    if type(x) not in [type(0), type(0L)]:
+    if type(x) not in [type(0), type(0)]:
         raise TypeError("Parameter must be an integer.")
     if x < 0:
         return '-' + intWithCommas(-x)
diff --git a/bin/Assemblytics_uniq_anchor.py b/bin/Assemblytics_uniq_anchor.py
index c1e0397..6d960f1 100755
--- a/bin/Assemblytics_uniq_anchor.py
+++ b/bin/Assemblytics_uniq_anchor.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/python3
 
 
 # Author: Maria Nattestad
@@ -22,27 +22,27 @@ def run(args):
     output_filename = args.out
     keep_small_uniques = args.keep_small_uniques
     if keep_small_uniques:
-        print "Keeping fully unique alignments even if they are below the unique anchor length of", unique_length, "bp"
+        print("Keeping fully unique alignments even if they are below the unique anchor length of", unique_length, "bp")
     else:
-        print "Discarding all alignments below the unique anchor length of", unique_length, "bp"
-        print "Use --keep-small-uniques to keep all the fully unique alignments even below this length"
+        print("Discarding all alignments below the unique anchor length of", unique_length, "bp")
+        print("Use --keep-small-uniques to keep all the fully unique alignments even below this length")
     if unique_length == 10000:
-        print "Use --unique-length X to set the unique anchor length requirement. Default is 10000, such that each alignment must have at least 10000 bp from the query that are not included in any other alignments."
+        print("Use --unique-length X to set the unique anchor length requirement. Default is 10000, such that each alignment must have at least 10000 bp from the query that are not included in any other alignments.")
 
 
-    print "header:"
+    print("header:")
     
     f = open(filename)
     header1 = f.readline()
     if header1[0:2]=="\x1f\x8b":
         f.close()
         f = gzip.open(filename)
-        print f.readline().strip()
+        print(f.readline().strip())
     else:
-        print header1.strip()
+        print(header1.strip())
     
     # Ignore the first two lines for now
-    print f.readline().strip()
+    print(f.readline().strip())
 
     linecounter = 0
 
@@ -89,13 +89,13 @@ def run(args):
 
     f.close()
 
-    print "First read through the file: %d seconds for %d query-reference combinations" % (time.time()-before,linecounter)
+    print("First read through the file: %d seconds for %d query-reference combinations" % (time.time()-before,linecounter))
     
 
     before = time.time()
     alignments_to_keep = {}
     num_queries = len(lines_by_query)
-    print "Filtering alignments of %d queries" % (num_queries)
+    print("Filtering alignments of %d queries" % (num_queries))
     
     num_query_step_to_report = num_queries/100
     if num_queries < 100:
@@ -134,10 +134,10 @@ def run(args):
 
         query_counter += 1
         if (query_counter % num_query_step_to_report) == 0:
-            print "Progress: %d%%" % (query_counter*100/num_queries)
-    print "Progress: 100%"
+            print("Progress: %d%%" % (query_counter*100/num_queries))
+    print("Progress: 100%")
 
-    print "Deciding which alignments to keep: %d seconds for %d queries" % (time.time()-before,num_queries)
+    print("Deciding which alignments to keep: %d seconds for %d queries" % (time.time()-before,num_queries))
     before = time.time()
 
 
@@ -234,7 +234,7 @@ def run(args):
     fcoords_out_tab.close()
     fcoords_out_csv.close()
 
-    print "Reading file and recording all the entries we decided to keep: %d seconds for %d total lines in file" % (time.time()-before,linecounter)
+    print("Reading file and recording all the entries we decided to keep: %d seconds for %d total lines in file" % (time.time()-before,linecounter))
 
     ref_lengths.sort()
     query_lengths.sort()
@@ -290,7 +290,7 @@ def gig_meg(number,digits = 2):
         return str(number) + " bp"
 
 def intWithCommas(x):
-    if type(x) not in [type(0), type(0L)]:
+    if type(x) not in [type(0), type(0)]:
         raise TypeError("Parameter must be an integer.")
     if x < 0:
         return '-' + intWithCommas(-x)
diff --git a/bin/Assemblytics_within_alignment.py b/bin/Assemblytics_within_alignment.py
index d7820a4..242eb53 100755
--- a/bin/Assemblytics_within_alignment.py
+++ b/bin/Assemblytics_within_alignment.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/python3
 import argparse
 
 import gzip
@@ -87,7 +87,7 @@ def run(args):
         # report = "%s\t%d\t%d\tAssemblytics_%d\t%d\t%s\t%s\t%d\t%d\t%s\t%s\n" % line
         if line[4] >= minimum_variant_size:
             line[3] = "Assemblytics_w_%d" % (newcounter)
-            print "\t".join(map(str,line[0:10])) + ":" + str(line[11]) + "-" + str(line[12]) + ":+\t" + line[10]
+            print("\t".join(map(str,line[0:10])) + ":" + str(line[11]) + "-" + str(line[12]) + ":+\t" + line[10])
             # print "\t".join(map(str,line))
             newcounter += 1