def filter_data(data, min_samples):
    """
    Remove all alleles from data that have less than min_samples
    samples.
    """
    for marker in data['alleles'].keys():
        for allele in data['alleles'][marker].keys():
            if len(data['alleles'][marker][allele]) < min_samples:
                del data['alleles'][marker][allele]
                continue
        if not data['alleles'][marker]:
            del data['alleles'][marker]
