Skip to content

Commit

Permalink
Add catch for files with less then N lines in function get_first_n_se…
Browse files Browse the repository at this point in the history
…q_identifiers
  • Loading branch information
ljmciver committed Mar 15, 2022
1 parent f79b3c5 commit 23a3834
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kneaddata/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,10 @@ def get_first_n_seq_identifiers(file,n):
first_seq_identifiers=[]
# Getting first nth seq identifier
while(count<n):
lines=next(all_lines)
try:
lines=next(all_lines)
except StopIteration:
sys.exit("ERROR: {0} has less then {1} lines".format(file,n))
first_seq_identifiers.append(lines[0])
count+=1
return first_seq_identifiers
Expand Down

0 comments on commit 23a3834

Please sign in to comment.