- python
from collections import Counter
with open('srg1.r1.paired.fq','r') as Fileout, open('srg1.r1.paired.results.txt','w') as Filein:
i = 4
dic, arr = {}, []
while True:
line = Fileout.readline()
i += 1
if i%4 == 2:
arr.append(len(str(line)))
if not line:
break
- shell
awk 'NR%4 == 2 {lengths[length($0)]++} END {for (l in lengths) {print l, lengths[l]}}' file.fastq
And
awk 'NR%4 == 2 {lengths[length($0)]++ ; counter++} END {for (l in lengths) {print l, lengths[l]}; print "total reads: " counter}' file.fastq
网友评论