view seqlens.py @ 1:d1130c342dc9 draft

"planemo upload for repository https://github.com/galaxy-works/shed-tools/tree/main/tools/seqprep commit f933f2d9276c45dbcd5e34a4e6c27c1f0029d016"
author galaxyworks
date Sun, 28 Feb 2021 21:52:26 +0000
parents f25733322c54
children
line wrap: on
line source

#!/usr/bin/env python
from collections import defaultdict
from operator import itemgetter
from sys import stdin


seqlens = defaultdict(int)
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(seqlens.items(), key=itemgetter(0), reverse=True):
    print("%d\t%d" % (length, count))