def _fastq_generic2(in_handle, out_handle, mapping, truncate_char, truncate_msg):
 from Bio.SeqIO.QualityIO import FastqGeneralIterator
 count = 0
 null = chr(0)
 for (title, seq, old_qual) in FastqGeneralIterator(in_handle):
  count += 1
  qual = old_qual.translate(mapping)
  if (null in qual):
   raise ValueError('Invalid character in quality string')
  if (truncate_char in qual):
   qual = qual.replace(truncate_char, chr(126))
   import warnings
   warnings.warn(truncate_msg, BiopythonWarning)
  out_handle.write(('@%s\n%s\n+\n%s\n' % (title, seq, qual)))
 return count

def _fastq_generic2 ( in_handle , out_handle , mapping , truncate_char , truncate_msg ) : from Bio . SeqIO . QualityIO import FastqGeneralIterator count = 0 null = chr ( 0 ) for ( title , seq , old_qual ) in FastqGeneralIterator ( in_handle ) : count += 1 qual = old_qual . translate ( mapping ) if ( null in qual ) : raise ValueError ( 'Invalid character in quality string' ) if ( truncate_char in qual ) : qual = qual . replace ( truncate_char , chr ( 126 ) ) import warnings warnings . warn ( truncate_msg , BiopythonWarning ) out_handle . write ( ( '@%s\n%s\n+\n%s\n' % ( title , seq , qual ) ) ) return count
fastq helper function where there could be data loss by truncation .