def _fastq_sanger_convert_fastq_solexa(in_handle, out_handle, alphabet=None): """Fast Sanger FASTQ to Solexa FASTQ conversion (PRIVATE). Avoids creating SeqRecord and Seq objects in order to speed up this conversion. Will issue a warning if the scores had to be truncated at 62 (maximum possible in the Solexa FASTQ format) """ # Map unexpected chars to null from Bio.SeqIO.QualityIO import solexa_quality_from_phred trunc_char = chr(1) mapping = "".join( [chr(0) for ascii in range(0, 33)] + [chr(64 + int(round(solexa_quality_from_phred(q)))) for q in range(0, 62 + 1)] + [trunc_char for ascii in range(96, 127)] + [chr(0) for ascii in range(127, 256)] ) assert len(mapping) == 256 return _fastq_generic2( in_handle, out_handle, mapping, trunc_char, "Data loss - max Solexa quality 62 in Solexa FASTQ", )
def _fastq_illumina_convert_fastq_solexa(in_handle, out_handle, alphabet=None): """Fast Illumina 1.3+ FASTQ to Solexa FASTQ conversion (PRIVATE). Avoids creating SeqRecord and Seq objects in order to speed up this conversion. """ # Map unexpected chars to null from Bio.SeqIO.QualityIO import solexa_quality_from_phred mapping = "".join([chr(0) for ascii in range(0, 64)] + [chr(64 + int(round(solexa_quality_from_phred(q)))) for q in range(0, 62 + 1)] + [chr(0) for ascii in range(127, 256)]) assert len(mapping) == 256 return _fastq_generic(in_handle, out_handle, mapping)
def _fastq_sanger_convert_fastq_solexa(in_handle, out_handle, alphabet=None): """Fast Sanger FASTQ to Solexa FASTQ conversion (PRIVATE). Avoids creating SeqRecord and Seq objects in order to speed up this conversion. Will issue a warning if the scores had to be truncated at 62 (maximum possible in the Solexa FASTQ format) """ #Map unexpected chars to null from Bio.SeqIO.QualityIO import solexa_quality_from_phred trunc_char = chr(1) mapping = "".join([chr(0) for ascii in range(0, 33)] \ +[chr(64+int(round(solexa_quality_from_phred(q)))) \ for q in range(0, 62+1)] \ +[trunc_char for ascii in range(96, 127)] \ +[chr(0) for ascii in range(127, 256)]) assert len(mapping)==256 return _fastq_generic2(in_handle, out_handle, mapping, trunc_char, "Data loss - max Solexa quality 62 in Solexa FASTQ")