def phred64to33(inputFq, outputFq): '''convert phred64 scaling fastq file format to phred33.''' from Bio import SeqIO if inputFq.endswith('.gz'): tmpIN = re.sub(r'.gz$', '', inputFq) assert not os.system('gzip -cdf %s > %s' % (inputFq, tmpIN)) else: tmpIN = inputFq if outputFq.endswith('.gz'): tmpOUT = re.sub(r'.gz$', '', outputFq) SeqIO.covert(tmpIN, "fastq-illumina", tmpOUT, "fastq-sanger") assert not os.system('gzip -f %s' % tmpOUT) else: SeqIO.covert(tmpIN, "fastq-illumina", outputFq, "fastq-sanger")