import collections


def major_allele_frequency(variant):
  """Returns the frequency of the most common allele in the variant."""
  count_dict = collections.defaultdict(int)
  for call in variant.calls:
    for geno in call.genotype:
      count_dict[geno] += 1
  denom = sum(cnt for geno, cnt in count_dict.items() if geno >= 0)
  if denom > 0:
    numer = max(cnt for geno, cnt in count_dict.items() if geno >= 0)
    return float(numer) / denom
  else:
    return 0