def truncate_fasta_qual(fasta_fp, qual_fp, output_dir, base_pos):
 qual_lines = open(qual_fp, 'U')
 fasta_lines = open(fasta_fp, 'U')
 qual_scores = parse_qual_score(qual_lines, value_cast_f=str)
 (fasta_seqs, seq_order) = parse_fasta_file(fasta_lines)
 verify_equivalency(fasta_seqs, qual_scores)
 (trunc_fasta_seqs, trunc_qual_scores) = truncate_seqs(fasta_seqs, qual_scores, base_pos)
 (fasta_out_fp, qual_out_fp) = get_output_filepaths(output_dir, fasta_fp, qual_fp)
 write_trunc_fasta(trunc_fasta_seqs, fasta_out_fp, seq_order)
 write_trunc_qual(trunc_qual_scores, qual_out_fp, seq_order)

def truncate_fasta_qual ( fasta_fp , qual_fp , output_dir , base_pos ) : qual_lines = open ( qual_fp , 'U' ) fasta_lines = open ( fasta_fp , 'U' ) qual_scores = parse_qual_score ( qual_lines , value_cast_f = str ) ( fasta_seqs , seq_order ) = parse_fasta_file ( fasta_lines ) verify_equivalency ( fasta_seqs , qual_scores ) ( trunc_fasta_seqs , trunc_qual_scores ) = truncate_seqs ( fasta_seqs , qual_scores , base_pos ) ( fasta_out_fp , qual_out_fp ) = get_output_filepaths ( output_dir , fasta_fp , qual_fp ) write_trunc_fasta ( trunc_fasta_seqs , fasta_out_fp , seq_order ) write_trunc_qual ( trunc_qual_scores , qual_out_fp , seq_order )
main program function for generating quality score histogram fasta_fp: fasta filepath qual_fp: quality score filepath output_dir: output directory base_pos: nucleotide position to truncate the fasta and quality score at .