def guess_phred_format(self):
<EOL>self.intervals = {<EOL>'<STR_LIT>':       (<NUM_LIT>,  <NUM_LIT>),         <EOL>'<STR_LIT>':       (<NUM_LIT>, <NUM_LIT>),<EOL>'<STR_LIT>': (<NUM_LIT:64>, <NUM_LIT>),         <EOL>'<STR_LIT>': (<NUM_LIT>, <NUM_LIT>),         <EOL>}<EOL>glob_min  = <NUM_LIT><EOL>glob_max  = <NUM_LIT:0><EOL>take_next = False<EOL>max_sequences_to_consider = <NUM_LIT><EOL>message = "<STR_LIT>"<EOL>self.open()<EOL>for i, line in enumerate(self.handle):<EOL><INDENT>if not take_next:<EOL><INDENT>take_next = line.startswith('<STR_LIT:+>')<EOL>continue<EOL><DEDENT>take_next = False<EOL>current_min, current_max = self.get_qual_range(line.rstrip('<STR_LIT:\n>'))<EOL>if current_min < glob_min or current_max > glob_max:<EOL><INDENT>glob_min = min(current_min, glob_min)<EOL>glob_max = max(current_max, glob_max)<EOL>valid_encodings = [e for e, r in self.intervals.items() if glob_min >= r[<NUM_LIT:0>] and glob_max <= r[<NUM_LIT:1>]]<EOL>if len(valid_encodings) == <NUM_LIT:0>:<EOL><INDENT>message = "<STR_LIT>"<EOL>break<EOL><DEDENT>if len(valid_encodings) == <NUM_LIT:1>:<EOL><INDENT>return valid_encodings[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>if i >= max_sequences_to_consider: break<EOL><DEDENT>message += "<STR_LIT>"<EOL>message += "<STR_LIT>"<EOL>message += "<STR_LIT>"<EOL>message  = message % (self, glob_max, glob_min, '<STR_LIT>'.join(valid_encodings))<EOL>raise Exception(message)<EOL>
Guess the PHRED score format. The gold standard is the first one, aka
        the one called "Sanger". Sanger encoding is exactly equivalent to
        Illumina-1.8 encoding. In other words, they finally gave up with their bullshit.