Skip to content

Commit 890e71e

Browse files
committed
remove flake8 errors
1 parent ad102bc commit 890e71e

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

mirtop/mirna/mintplates.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ def encode_sequence(sequence, prefix):
509509
"""
510510
length = len(sequence)
511511
# Encode label
512-
if prefix is '':
512+
if prefix == '':
513513
final_result = [(str(length) + '-')]
514514
else:
515515
final_result = [prefix + "-" + str(length) + "-"]

scripts/import_gff3.py

+30-30
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def loadfile(filename,verbose=True):
1111

1212
try:
1313
if verbose==True:
14-
print 'Loading', filename
14+
print('Loading', filename)
1515
# obtaning sample names and number from 3rd line in header
1616
num_header_lines=0
1717
with open(filename) as f:
@@ -26,12 +26,12 @@ def loadfile(filename,verbose=True):
2626
num_header_lines+=1
2727
sample_number = len(sample_names)
2828
if verbose==True:
29-
print '--------------------------------------'
30-
print sample_number,' samples in the file'
31-
print '--------------------------------------'
29+
print('--------------------------------------')
30+
print(sample_number,' samples in the file')
31+
print('--------------------------------------')
3232
for elem in sample_names:
33-
print elem
34-
print '--------------------------------------'
33+
print(elem)
34+
print('--------------------------------------')
3535

3636

3737

@@ -59,11 +59,11 @@ def loadfile(filename,verbose=True):
5959
num_attr = len(attr_names) #number of attributes
6060
#expression_colindex=attr_names.index ('Expression') #position of the expression column in the attr column
6161
if verbose==True:
62-
print num_attr,' attributes in the file '
63-
print '--------------------------------------'
62+
print(num_attr,' attributes in the file ')
63+
print('--------------------------------------')
6464
for attr in attr_names:
65-
print attr
66-
print '--------------------------------------'
65+
print(attr)
66+
print('--------------------------------------')
6767

6868
# joining rows of attributes without the descriptor
6969
for row in range(atr_data.shape[0]):
@@ -113,7 +113,7 @@ def loadfile(filename,verbose=True):
113113
data.at[row.Index,var]=np.nan
114114
return data
115115
except:
116-
print 'Error loading the file'
116+
print('Error loading the file')
117117

118118

119119
"""
@@ -137,7 +137,7 @@ def load_check_gff3(filename):
137137
data_1=rowfile.split('\t')
138138
break
139139
if coldata_found==False:
140-
print 'No COLDATA, bad header'
140+
print('No COLDATA, bad header')
141141
return False
142142

143143
#Number of columns without breaking down attributes column
@@ -155,33 +155,33 @@ def load_check_gff3(filename):
155155
for attr in list_attr:
156156
if attr not in possible_attr:
157157
Error=True
158-
print attr,'is not a possible attribute'
158+
print(attr,'is not a possible attribute')
159159
break
160160
if Error:
161-
print 'File format error'
161+
print('File format error')
162162
return False
163163
# If not format error, loading content
164164
try:
165165
dataframe=loadfile(filename,True)
166166
except:
167-
print 'Error loading file'
167+
print('Error loading file')
168168
return False
169-
print 'Checking content'
169+
print('Checking content')
170170
for i in range(dataframe.shape[0]):
171171
# Labels in type column
172172
if dataframe.loc[i, 'type'] not in ['ref_miRNA', 'isomiR']:
173173
Error = True
174-
print'line', i, 'pip install Markdownbad type error'
174+
print('line', i, 'pip install Markdownbad type error')
175175

176176
# start<end
177177
if dataframe.loc[i, 'start'] >= dataframe.loc[i, 'end']:
178178
Error = True
179-
print 'line', i, 'start >=end error'
179+
print('line', i, 'start >=end error')
180180

181181
# Strand + or -
182182
if dataframe.loc[i, 'strand'] not in ['+', '-']:
183183
Error = True
184-
print 'line', i, 'bad strand error'
184+
print('line', i, 'bad strand error')
185185
# Variant checking
186186
possible_variant=['iso_5p','iso_3p','iso_add','iso_snp_seed','iso_snp_central_offset','iso_snp_central',
187187
'iso_central_supp','iso_snp_central_supp','iso_snp']
@@ -191,36 +191,36 @@ def load_check_gff3(filename):
191191
if len(variant_i)==1 and variant_i[0]!='NA':
192192
if variant_i[0].split(':')[0] not in possible_variant:
193193
Error = True
194-
print 'Variant error', variant_i[0].split(':')[0], 'line', i
194+
print('Variant error', variant_i[0].split(':')[0], 'line', i)
195195
elif variant_i[0]!='NA':
196196
for var in range(len(variant_i)):
197197
if variant_i[var].split(':')[0] not in possible_variant:
198198
Error = True
199-
print 'Variant error', variant_i[0].split(':')[0], 'line', i
199+
print('Variant error', variant_i[0].split(':')[0], 'line', i)
200200

201201
#Checking expression data
202202
expression_cols=[col for col in dataframe.columns if 'Expression_' in col]
203203
for col in expression_cols:
204204
for i in range(dataframe.shape[0]):
205205
if not dataframe.loc[i,col].isdigit():
206-
print dataframe.loc[i,col].isdigit()
207-
print 'Expression count error line',i
206+
print(dataframe.loc[i,col].isdigit())
207+
print('Expression count error line',i)
208208
Error= True
209209
dataframe[col]=dataframe[col].astype(int) #setting the datatype of counts
210210
dataframe[col]=dataframe[col].replace(0,np.nan) #Setting 0 reads to NaN
211211
if 'Filter' in dataframe.columns:
212212
for i in range(dataframe.shape[0]):
213213
if dataframe.loc[i, 'Filter']!='Pass':
214-
print 'Warning non-pass filter in line',i
214+
print('Warning non-pass filter in line',i)
215215
if Error:
216-
print 'File format error'
216+
print('File format error')
217217
return False
218218

219-
print '--------------------------------------'
220-
print dataframe.dtypes
221-
print '--------------------------------------'
222-
print 'Format ok'
219+
print('--------------------------------------')
220+
print(dataframe.dtypes)
221+
print('--------------------------------------')
222+
print('Format ok')
223223
return dataframe
224224
except:
225-
print 'Error checking the file'
225+
print('Error checking the file')
226226
return False

scripts/prepare.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _download(url, outfn):
6262
for mir in fa:
6363
if mir in bed:
6464
precursor = bed[mir][mir + "_pre"]
65-
print precursor
65+
print(precursor)
6666
mir5p = ""
6767
mir3p = ""
6868
for mature in bed[mir]:
@@ -82,7 +82,7 @@ def _download(url, outfn):
8282
if mature.find("3p") > 0:
8383
mir3p = "[%s:%s-%s]" % (mature, start, end)
8484

85-
print >>OUT, ">%s (X) %s %s" % (mir, mir5p, mir3p)
86-
print >>OUTP, ">%s\n%s" % (mir, fa[mir])
85+
print(">%s (X) %s %s" % (mir, mir5p, mir3p), file=OUT)
86+
print(">%s\n%s" % (mir, fa[mir]),file=OUTP)
8787
OUT.close()
8888
OUTP.close()

0 commit comments

Comments
 (0)