Mercurial > repos > galaxyworks > seqprep
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f25733322c54 |
---|---|
1 #!/usr/bin/env python | |
2 from collections import defaultdict | |
3 from operator import itemgetter | |
4 from sys import stdin | |
5 | |
6 | |
7 seqlens = defaultdict(int) | |
8 next_line_seq = False | |
9 count = 0 | |
10 for line in stdin: | |
11 count += 1 | |
12 if line.startswith("@"): | |
13 count = 0 | |
14 next_line_seq = True | |
15 | |
16 if next_line_seq and count == 1: | |
17 next_line_seq = False | |
18 seqlens[len(line)] += 1 | |
19 | |
20 for (length, count) in sorted(seqlens.items(), key=itemgetter(0), reverse=True): | |
21 print("%d\t%d" % (length, count)) |