def generate_histogram(qual_fp, output_dir, score_min=25, verbose=True, qual_parser=parse_qual_score):
 if qual_fp.endswith('.gz'):
  qual_lines = gzip_open(qual_fp)
 else:
  qual_lines = open(qual_fp, 'U')
 qual_scores = qual_parser(qual_lines)
 qual_bins = bin_qual_scores(qual_scores)
 (ave_bins, std_dev_bins, total_bases_bins, suggested_trunc_pos) = get_qual_stats(qual_bins, score_min)
 plot_qual_report(ave_bins, std_dev_bins, total_bases_bins, score_min, output_dir)
 write_qual_report(ave_bins, std_dev_bins, total_bases_bins, output_dir, suggested_trunc_pos)
 if verbose:
  print ('Suggested nucleotide truncation position (None if quality ' + ('score average did not fall below the minimum score parameter): %s\n' % suggested_trunc_pos))

def generate_histogram ( qual_fp , output_dir , score_min = 25 , verbose = True , qual_parser = parse_qual_score ) : if qual_fp . endswith ( '.gz' ) : qual_lines = gzip_open ( qual_fp ) else : qual_lines = open ( qual_fp , 'U' ) qual_scores = qual_parser ( qual_lines ) qual_bins = bin_qual_scores ( qual_scores ) ( ave_bins , std_dev_bins , total_bases_bins , suggested_trunc_pos ) = get_qual_stats ( qual_bins , score_min ) plot_qual_report ( ave_bins , std_dev_bins , total_bases_bins , score_min , output_dir ) write_qual_report ( ave_bins , std_dev_bins , total_bases_bins , output_dir , suggested_trunc_pos ) if verbose : print ( 'Suggested nucleotide truncation position (None if quality ' + ( 'score average did not fall below the minimum score parameter): %s\n' % suggested_trunc_pos ) )
main program function for generating quality score histogram qual_fp: quality score filepath output_dir: output directory score_min: minimum score to be considered a reliable base call .