def get_gqx(record, sample):
    """
    Get GQX value from a pyvcf record
    :param record: an instance of a pyvcf Record
    :param sample: sample name
    :return: float
    """
    fmt = record.genotype(sample)
    if hasattr(fmt.data, "GQ") and record.QUAL:
        return min(float(fmt.data.GQ), record.QUAL)
    elif hasattr(fmt.data, "GQ"):
        return float(fmt.data.GQ)
    elif record.QUAL:
        return record.QUAL
    else:
        return None