-
Notifications
You must be signed in to change notification settings - Fork 2
/
fastqReadLength.py
44 lines (35 loc) · 973 Bytes
/
fastqReadLength.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
##################################
# #
# Last modified 07/10/2011 #
# #
# Georgi Marinov #
# #
##################################
import sys
try:
import psyco
psyco.full()
except:
pass
def main(argv):
if len(argv) < 2:
print 'usage: python %s <list of fastqfiles> outfilename' % argv[0]
sys.exit(1)
inputfilename = argv[1]
outputfilename = argv[2]
outfile = open(outputfilename, 'w')
input_stream = open(inputfilename)
for line1 in input_stream:
file=line1.strip().split('\t')[0]
linelist=open(file)
i=0
print file
for line in linelist:
i+=1
if i==2:
read=len(line.strip())
outfile.write(file + '\t' + str(read) + '\n')
break
outfile.close()
if __name__ == '__main__':
main(sys.argv)