view seqlens.py @ 0:f25733322c54 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/iqtree/ commit 85099b149e64f24060848cb04c680e0ac8061d76"
author galaxyworks
date Fri, 26 Feb 2021 04:26:20 +0000
parents
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))