def counts_filter(countsd, nalleles, seqid):
    # Check for variability
    if len(countsd) < 2:
        return True

    # Check for missingness
    observed = sum(countsd.values())
    observed_pct = observed * 100  / nalleles
    if observed_pct < 50:
        if not (seqid == "chrY" and observed_pct >= 25):
            return True
dataset/ETHPy150Open tanghaibao/jcvi/variation/str.py/counts_filter/original