def ploidy(variant_call):
  """Returns the ploidy of the VariantCall.

  Args:
    variant_call: VariantCall proto. The VariantCall to evaluate.

  Returns:
    The ploidy of the call (a non-negative integer).
  """
  # Unknown genotypes are represented as -1 in VariantCall protos. When
  # a VCF is parsed that contains multiple ploidies in different samples,
  # a separate padding value of -2**30 - 1 is inserted into the calls.
  return sum(gt >= -1 for gt in variant_call.genotype)