File: qualdist.py

package info (click to toggle)
poretools 0.6.0%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 95,200 kB
  • sloc: python: 1,795; makefile: 109; sh: 98
file content (19 lines) | stat: -rw-r--r-- 454 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from . import Fast5File
from collections import Counter

def run(parser, args):

	qual_count = Counter()
	total_nucs = 0

	for fast5 in Fast5File.Fast5FileSet(args.files):
		fq = fast5.get_fastq()
		if fq is not None:
			for q in fq.qual:
				qual_count[ord(q)-33] += 1
				total_nucs += 1
		fast5.close()

	for q in qual_count:
		print ('\t'.join(str(s) for s in [chr(q+33), q, qual_count[q], 
			total_nucs, float(qual_count[q]) / float(total_nucs)]))