class_docstr: Represents the reference genome spanned by overlapping Variants.
  
  Each Variant affects a portion of the reference genome that is determined by
  its start and end coordinates. For a given set of Variants, they are deemed
  compatible if the total area along the reference genome that is called as
  non-reference genotypes never exceeds the ploidy of the organism.
docstr: Returns True if and only if all variants are compatible.
  
  Args:
    nonref_genotype_counts: list of ints in [0, ploidy]. Element i in this
      list represents the number of non-reference genotypes for the i'th
      variant.
    ploidy: int. The ploidy of the individual.
  
  Returns:
    True if and only if the variants are compatible.
  
  Raises:
    ValueError: nonref_genotype_counts is not the same length as
      self.variant_indices.
    ValueError: nonref_genotype_counts does not contain elements in [0,
    ploidy].
docstr_tok: ["Returns","True","if","and","only","if","all","variants","are","compatible",".","Args",":","nonref_genotype_counts",":","list","of","ints","in","[","0",",","ploidy","]",".","Element","i","in","this","list","represents","the","number","of","non-reference","genotypes","for","the","i'th","variant",".","ploidy",":","int",".","The","ploidy","of","the","individual",".","Returns",":","True","if","and","only","if","the","variants","are","compatible",".","Raises",":","ValueError",":","nonref_genotype_counts","is","not","the","same","length","as","self.variant_indices",".","ValueError",":","nonref_genotype_counts","does","not","contain","elements","in","[","0",",","ploidy","]","."]
code: def all_variants_compatible(self, nonref_genotype_counts, ploidy=2):
      """Returns True if and only if all variants are compatible.
  
      Args:
        nonref_genotype_counts: list of ints in [0, ploidy]. Element i in this
          list represents the number of non-reference genotypes for the i'th
          variant.
        ploidy: int. The ploidy of the individual.
  
      Returns:
        True if and only if the variants are compatible.
  
      Raises:
        ValueError: nonref_genotype_counts is not the same length as
          self.variant_indices.
        ValueError: nonref_genotype_counts does not contain elements in [0,
        ploidy].
      """
      if len(nonref_genotype_counts) != len(self.variant_indices):
          raise ValueError(
              "Variant counts must have same length as variant indices."
          )
      if not all(0 <= cnt <= ploidy for cnt in nonref_genotype_counts):
          raise ValueError(
              "Invalid variant allele count for ploidy {}: {}".format(
                  ploidy, nonref_genotype_counts
              )
          )
  
      alts_in_span = np.zeros(self.size, dtype=int)
      for cnt, (start, end) in zip(
          nonref_genotype_counts, self.variant_indices
      ):
          alts_in_span[start:end] += cnt
      return np.all(alts_in_span <= ploidy)
  
imports: import copy
  import itertools
  from absl import flags
  from absl import logging
  import numpy
  from third_party.nucleus.util import genomics_math
  from third_party.nucleus.util import variant_utils
label_desc: Use image node_id 2 for calling the _VariantCompatibilityCalculator obj's underlying member method code with example usage: obj.all_variants_compatible(nonref_genotype_counts, ploidy) and returns: np