File: seqlens.py

package info (click to toggle)
seqprep 1.3.2-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 64,480 kB
  • sloc: ansic: 2,432; python: 165; sh: 89; makefile: 39
file content (23 lines) | stat: -rwxr-xr-x 473 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/python3

from collections import defaultdict
from operator import itemgetter
seqlens = defaultdict(int)

from sys import stdin

next_line_seq = False
count = 0
for line in stdin:
	count += 1
	if line.startswith("@"):
		count = 0
		next_line_seq = True
	if next_line_seq and count == 1:
		next_line_seq == False
		seqlens[len(line)] += 1
		
	

for (length,count) in sorted(iter(seqlens.items()), key=itemgetter(0),reverse=True):
	print(("%d\t%d"%(length,count)))