File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -138,13 +138,17 @@ def main():
138
138
139
139
if not os .path .exists (args2 .DNA ):
140
140
errors .append (f"ERROR: DNA file '{ args2 .DNA } ' not found" )
141
- elif not args2 .DNA .endswith (".fasta" ):
142
- errors .append (f"ERROR: DNA file '{ args2 .DNA } ' must be in FASTA format" )
141
+ else :
142
+ with open (args2 .DNA ) as f :
143
+ if not f .readline ().startswith (">" ):
144
+ errors .append (f"ERROR: DNA file '{ args2 .DNA } ' must be in FASTA format" )
143
145
144
146
if not os .path .exists (args2 .patterns ):
145
147
errors .append (f"ERROR: Pattern file '{ args2 .patterns } ' not found" )
146
- elif not args2 .patterns .endswith (".fasta" ):
147
- errors .append (f"ERROR: DNA file '{ args2 .patterns } ' must be in FASTA format" )
148
+ else :
149
+ with open (args2 .patterns ) as f :
150
+ if not f .readline ().startswith (">" ):
151
+ errors .append (f"ERROR: DNA file '{ args2 .patterns } ' must be in FASTA format" )
148
152
149
153
if errors :
150
154
for error in errors :
@@ -191,4 +195,4 @@ def main():
191
195
except EmptySequenceException as e :
192
196
print (f"ERROR: { e .msg } " )
193
197
except ValueError as e :
194
- print (f"ERROR: { e } " )
198
+ print (f"ERROR: { e } " )
You can’t perform that action at this time.
0 commit comments