Skip to content

Commit

Permalink
Update SVMLight script to also check file sanity.
Browse files Browse the repository at this point in the history
  • Loading branch information
arnocandel committed May 23, 2015
1 parent 1f6f4c2 commit 0798e1c
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
dsorted = sorted(d.iteritems(), key=itemgetter(0), reverse=False)
with open(output, "a") as g:
g.write(target + ' ')
prev_i=-1
for (i,j) in dsorted:
if(i == 0):
print("Column index must be >= 1: " + dsorted)
exit(1)
if(i == prev_i):
print("Repeats found: " + dsorted)
exit(1)
prev_i = i
g.write(str(i)+':'+str(j)+' ')
g.write('\n')

0 comments on commit 0798e1c

Please sign in to comment.