def read_is_high_quality(var_start, read, mate_read):
    """
    Check if the read passes few QC checks like MQ > mpq, no duplicate, mapped
    :param var_start: The variant position (integer)
    :param read: A pysam read object
    :return: Boolean
    """
    base_idx = abs((read.reference_start + 1) - var_start)
    if base_idx > read.rlen - 1:
        return False  # the variant is not in this read (the read is at its boundary)
    if read.is_duplicate:
        return False
    if read.is_qcfail:
        return False
    if read.is_unmapped:
        return False
    if read.mapq < 20:
        return False
    if read.mate_is_unmapped:  # when the mate is unmapped it will break the mate(read) method below. Ignore these.
        return False
    if not read.is_paired:   # when the mate is missing it will break the mate(read) method below. Ignore these.
        return False
    if var_start in read.positions and var_start in mate_read.positions:  # pair-read overlaps and inflating counts
        return False
    return True