view seqlens.py @ 2:dd2c54f4a12e draft default tip

"planemo upload for repository https://github.com/galaxy-works/shed-tools/tree/main/tools/seqprep commit 80ec6fb196df94824c51fc6b0357156182df541e"
author galaxyworks
date Sun, 28 Feb 2021 22:21:38 +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))