def determine_score_type(args): with FileOrGzip(args.fastq) as infile: count = 0 letter_freq = collections.defaultdict(int) for rid, seq, qual in fastq.read(infile): count += 1 for l in qual: letter_freq[l] += 1 if count == 5000: break print guess_score_type(letter_freq)
def to_phred33(args): if args.score_type == "phred64": table = phred64_to_phred33 elif args.score_type == "solexa": table = solexa_to_phred33 elif args.score_type == "phred33+": table = phred33plus_to_phred33 out = "@{0}\n{1}\n+\n{2}" with FileOrGzip(args.fastq) as infile: for rid, rseq, rqual in fastq.read(infile): print out.format(rid, rseq, rqual.translate(table))