def ave_qual(quals, qround=False, tab=errs_tab(<NUM_LIT>)):
if quals:<EOL><INDENT>mq = -<NUM_LIT:10> * log(sum([tab[q] for q in quals]) / len(quals), <NUM_LIT:10>)<EOL>if qround:<EOL><INDENT>return round(mq)<EOL><DEDENT>else:<EOL><INDENT>return mq<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>
Calculate average basecall quality of a read.

    Receive the integer quality scores of a read and return the average quality for that read
    First convert Phred scores to probabilities,
    calculate average error probability
    convert average back to Phred scale