I have a script where python should take each line at a time and do lots of stuffs (alignment and co.) So I tried to use count in order to iterate over every lines in my input file.
However, when I run it, it only uses the last line of the input files and runs the rest with it until the end. So the script is alright but iteration not at all For a test, I tried with only 4 lines and this is the iterating part of the script:
for line in open(sys.argv[1]):
count+=1
if count < 4 :
continue
elif count > 4 :
break
I tried to write a test script to see if it does run every lines:
count = 0
file = open('mclOutput2', 'r')
while True:
count+=1
if count < 4:
print file.readlines()
elif count > 4 :
break
And this is the output I get
['mono|comp78360_c0_seq1\tpoly|comp71317_c0_seq1\tturc|comp70178_c0_seq1\tturc|comp19023_c0_seq1\n', 'mono|comp78395_c0_seq1\trubr|comp23732_c0_seq1\trugi|comp32227_c0_seq1\tsulc|comp11641_c0_seq1\n', 'mono|comp80301_c0_seq1\tnegl|comp30782_c0_seq1\tphar|comp29363_c0_seq1\tpoly|comp53026_c0_seq2\n', 'mono|comp80554_c0_seq1\tnegl|comp27459_c0_seq1\tpoly|comp57863_c0_seq2\trugi|comp11691_c0_seq1\n']
[]
[]
I am not really sure how to fix it, any ideas what I am doing wrong?