def count_refs(pileup_base_string):
    """
    Given a pileup string from samtools mpileup output,
    count the number of reads that support the reference
    allele in that position.
    """
    ref_count = 0
    i = 0
    while i < len(pileup_base_string):
        if pileup_base_string[i] in [".", ","]:
            ref_count += 1
        # if the current character is '^', then the next
        # character will be a PHRED quality, so skip it.
        elif pileup_base_string[i] in ["^"]:
            i += 1
        i += 1

        # for other things, like insertions, deletions, and
        # ends of reads, there will not be any '.' or ','
        # characters to confuse us, so we don't need to
        # actually parse these out since all we care about
        # is the number of ref alleles

    return ref_count